upload_attachment_by_url
Upload files to NocoDB storage directly from web URLs, enabling AI agents to attach documents and media to database records without manual file handling.
Instructions
Upload files to NocoDB storage from URLs
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| urls | Yes | Array of URLs to upload | |
| storage_path | No | Optional path in NocoDB storage |
Implementation Reference
- src/tools/attachment.ts:80-102 (handler)The async handler function for the 'upload_attachment_by_url' tool. It takes NocoDBClient and args, calls client.uploadByUrl, and returns formatted success or error response.handler: async ( client: NocoDBClient, args: { urls: string[]; storage_path?: string; }, ) => { try { const result = await client.uploadByUrl(args.urls, args.storage_path); return { success: true, urls_count: args.urls.length, upload_result: result, message: "Files uploaded successfully from URLs", }; } catch (error: any) { return { success: false, error: error.message, urls: args.urls, }; } },
- src/tools/attachment.ts:63-79 (schema)Input JSON Schema for the tool, requiring 'urls' as array of strings, optional 'storage_path'.inputSchema: { type: "object", properties: { urls: { type: "array", description: "Array of URLs to upload", items: { type: "string", }, }, storage_path: { type: "string", description: "Optional path in NocoDB storage", }, }, required: ["urls"], },
- src/index.ts:55-62 (registration)MCP server registers tools by combining attachmentTools (including upload_attachment_by_url) into allTools array, used in ListToolsRequestSchema and CallToolRequestSchema handlers.const allTools = [ ...databaseTools, ...tableTools, ...recordTools, ...viewTools, ...queryTools, ...attachmentTools, ];
- src/nocodb-api.ts:438-447 (helper)Supporting method in NocoDBClient that formats URL data and POSTs to NocoDB's /api/v2/storage/upload-by-url endpoint to perform the upload.async uploadByUrl(urls: string[], storagePath?: string): Promise<any> { const urlData = urls.map((url) => ({ url })); const data = storagePath ? { urls: urlData, path: storagePath } : urlData; const response = await this.client.post( "/api/v2/storage/upload-by-url", data, ); return response.data; }