pohoda_download_file
Download files from POHODA documents storage. Retrieve file content for documents under 100KB or get size information for larger files using relative paths.
Instructions
Download a file from POHODA documents storage. Returns file size and base64 content for files under 100KB; for larger files returns size info only. Path is relative to documents root.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Relative path to the file in POHODA documents storage |
Implementation Reference
- src/tools/system.ts:87-100 (handler)The handler function for the pohoda_download_file tool that downloads a file using the POHODA client and returns its base64 content if it is under 100KB.
async ({ filePath }) => { try { const buf = await client.downloadFile(filePath); const size = buf.length; const sizeKb = size / 1024; if (size < 100 * 1024) { const base64 = buf.toString("base64"); return ok(`File size: ${size} bytes (${sizeKb.toFixed(1)} KB)\n\nBase64 content:\n${base64}`); } return ok(`File size: ${size} bytes (${sizeKb.toFixed(1)} KB). File too large for inline transfer; use external download for files over 100 KB.`); } catch (e) { return err((e as Error).message); } } - src/tools/system.ts:81-100 (registration)Registration of the pohoda_download_file tool.
server.tool( "pohoda_download_file", "Download a file from POHODA documents storage. Returns file size and base64 content for files under 100KB; for larger files returns size info only. Path is relative to documents root.", { filePath: z.string().describe("Relative path to the file in POHODA documents storage"), }, async ({ filePath }) => { try { const buf = await client.downloadFile(filePath); const size = buf.length; const sizeKb = size / 1024; if (size < 100 * 1024) { const base64 = buf.toString("base64"); return ok(`File size: ${size} bytes (${sizeKb.toFixed(1)} KB)\n\nBase64 content:\n${base64}`); } return ok(`File size: ${size} bytes (${sizeKb.toFixed(1)} KB). File too large for inline transfer; use external download for files over 100 KB.`); } catch (e) { return err((e as Error).message); } }