Skip to main content
Glama

get_attachment_info

Retrieve file attachment details from a specific record in a NocoDB database, including metadata and file information for managing document storage.

Instructions

Get information about file attachments in a record

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
base_idYesThe ID of the base/project
table_nameYesThe name of the table
record_idYesThe ID of the record
attachment_fieldYesThe name of the attachment field

Implementation Reference

  • The handler function executes the tool logic: retrieves the record using NocoDB client, extracts attachments from the specified field, handles JSON parsing if needed, and returns the list of attachments with count, field, and record ID.
    handler: async ( client: NocoDBClient, args: { base_id: string; table_name: string; record_id: string; attachment_field: string; }, ) => { const record = await client.getRecord( args.base_id, args.table_name, args.record_id, ); const attachments = record[args.attachment_field]; if (!attachments) { return { attachments: [], message: "No attachments found in the specified field", }; } // Parse attachment data if it's a JSON string const attachmentData = typeof attachments === "string" ? JSON.parse(attachments) : attachments; return { attachments: Array.isArray(attachmentData) ? attachmentData : [attachmentData], count: Array.isArray(attachmentData) ? attachmentData.length : 1, field: args.attachment_field, record_id: args.record_id, }; },
  • Input schema defining the required parameters: base_id, table_name, record_id, and attachment_field for retrieving attachment information.
    inputSchema: { type: "object", properties: { base_id: { type: "string", description: "The ID of the base/project", }, table_name: { type: "string", description: "The name of the table", }, record_id: { type: "string", description: "The ID of the record", }, attachment_field: { type: "string", description: "The name of the attachment field", }, }, required: ["base_id", "table_name", "record_id", "attachment_field"], },
  • The complete tool object for 'get_attachment_info' defined within the exported attachmentTools array, which is later included in the MCP server's tool list.
    { name: "get_attachment_info", description: "Get information about file attachments in a record", inputSchema: { type: "object", properties: { base_id: { type: "string", description: "The ID of the base/project", }, table_name: { type: "string", description: "The name of the table", }, record_id: { type: "string", description: "The ID of the record", }, attachment_field: { type: "string", description: "The name of the attachment field", }, }, required: ["base_id", "table_name", "record_id", "attachment_field"], }, handler: async ( client: NocoDBClient, args: { base_id: string; table_name: string; record_id: string; attachment_field: string; }, ) => { const record = await client.getRecord( args.base_id, args.table_name, args.record_id, ); const attachments = record[args.attachment_field]; if (!attachments) { return { attachments: [], message: "No attachments found in the specified field", }; } // Parse attachment data if it's a JSON string const attachmentData = typeof attachments === "string" ? JSON.parse(attachments) : attachments; return { attachments: Array.isArray(attachmentData) ? attachmentData : [attachmentData], count: Array.isArray(attachmentData) ? attachmentData.length : 1, field: args.attachment_field, record_id: args.record_id, }; }, },
  • src/index.ts:55-63 (registration)
    Registration of all tools, including attachmentTools (which contains get_attachment_info), into the allTools array used by the MCP server's ListTools and CallTool request handlers.
    const allTools = [ ...databaseTools, ...tableTools, ...recordTools, ...viewTools, ...queryTools, ...attachmentTools, ];

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/andrewlwn77/nocodb-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server