rustypaste_upload_file
Upload local files to rustypaste for sharing via URL. Specify file path to generate shareable download links.
Instructions
Upload a local file to rustypaste and get a shareable URL.
Reads a file from disk and uploads it to the rustypaste server. Supports any file type. The returned URL can be shared to download the file.
Args:
file_path (string): Absolute path to the file (e.g. "/home/user/doc.pdf")
Returns: The URL of the uploaded file.
Examples:
Upload an image: file_path="/home/user/screenshot.png"
Upload a document: file_path="/tmp/report.pdf"
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| file_path | Yes | Absolute path to the file to upload |
Implementation Reference
- src/tools/upload-file.ts:41-64 (handler)The handler function that executes the file upload using RustypasteClient.
async (params: Input) => { try { const client = new RustypasteClient(); const result = await client.uploadFile(params.file_path); return { content: [ { type: "text" as const, text: `✅ File uploaded successfully!\n\nURL: ${result.url}`, }, ], }; } catch (error) { return { isError: true, content: [ { type: "text" as const, text: `Error: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } - src/tools/upload-file.ts:5-10 (schema)The input schema definition for the rustypaste_upload_file tool.
const InputSchema = z.object({ file_path: z .string() .min(1, "File path must not be empty") .describe("Absolute path to the file to upload"), }); - src/tools/upload-file.ts:14-66 (registration)The registration function that defines the tool in the MCP server.
export function registerUploadFile(server: McpServer): void { server.registerTool( "rustypaste_upload_file", { title: "Upload File", description: `Upload a local file to rustypaste and get a shareable URL. Reads a file from disk and uploads it to the rustypaste server. Supports any file type. The returned URL can be shared to download the file. Args: - file_path (string): Absolute path to the file (e.g. "/home/user/doc.pdf") Returns: The URL of the uploaded file. Examples: - Upload an image: file_path="/home/user/screenshot.png" - Upload a document: file_path="/tmp/report.pdf"`, inputSchema: InputSchema, annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true, }, }, async (params: Input) => { try { const client = new RustypasteClient(); const result = await client.uploadFile(params.file_path); return { content: [ { type: "text" as const, text: `✅ File uploaded successfully!\n\nURL: ${result.url}`, }, ], }; } catch (error) { return { isError: true, content: [ { type: "text" as const, text: `Error: ${error instanceof Error ? error.message : String(error)}`, }, ], }; } } ); }