document-download
Retrieve documents from storage by specifying their path. Returns file content or a download URL for access.
Instructions
Download a document by its storage path. Returns the file content or a download URL.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Document storage path |
Implementation Reference
- src/tools/documents.ts:12-21 (handler)The handler function that executes the document download tool.
async (params) => { try { const response = await client.documents.download(params.path); const text = await response.text(); return { content: [{ type: "text", text }] }; } catch (err) { const message = err instanceof Error ? err.message : String(err); return { content: [{ type: "text", text: `Error: ${message}` }], isError: true }; } }, - src/tools/documents.ts:6-22 (registration)Tool registration for 'document-download' within the MCP server.
server.tool( "document-download", "Download a document by its storage path. Returns the file content or a download URL.", { path: z.string().describe("Document storage path"), }, async (params) => { try { const response = await client.documents.download(params.path); const text = await response.text(); return { content: [{ type: "text", text }] }; } catch (err) { const message = err instanceof Error ? err.message : String(err); return { content: [{ type: "text", text: `Error: ${message}` }], isError: true }; } }, );