24 lines
770 B
TypeScript
24 lines
770 B
TypeScript
import * as path from "node:path";
|
|
import { type } from "arktype";
|
|
import type { ToolContext } from "./server.ts";
|
|
import { execute, tool } from "./shared.ts";
|
|
|
|
const UploadFileParams = type({
|
|
path: type.string.describe("absolute path to file to upload"),
|
|
});
|
|
|
|
export function UploadFileTool(_ctx: ToolContext) {
|
|
return tool({
|
|
name: "upload_file",
|
|
description:
|
|
"Upload a file to get a public URL. Note: file upload is not configured in this shockbot deployment.",
|
|
parameters: UploadFileParams,
|
|
execute: execute(async (params) => {
|
|
const filename = path.basename(params.path);
|
|
throw new Error(
|
|
`File upload is not configured (${filename}). Commit files to the repository or use an external service.`
|
|
);
|
|
}),
|
|
});
|
|
}
|