Skip to main content
Glama
andrewlwn77
by andrewlwn77

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,
    ];
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It implies a read-only operation ('Get information'), but doesn't disclose critical details like authentication requirements, rate limits, error conditions (e.g., invalid attachment fields), or output format (e.g., JSON structure, pagination). This leaves significant gaps for agent decision-making.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, focused sentence with zero redundant words. It front-loads the core purpose ('Get information about file attachments in a record') without unnecessary elaboration. Every word earns its place, making it highly efficient for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (4 required parameters, no output schema, no annotations), the description is insufficient. It lacks details on what information is returned, how to interpret results, error handling, or integration with sibling tools (e.g., 'upload_attachment'). For a tool with no structured output documentation, more descriptive context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, providing clear documentation for all 4 parameters. The description adds no additional parameter context beyond what the schema already states (e.g., it doesn't clarify 'attachment_field' semantics or provide examples). This meets the baseline for high schema coverage but doesn't enhance understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get information') and target ('about file attachments in a record'), which distinguishes it from sibling tools like 'attach_file_to_record' or 'upload_attachment'. However, it doesn't specify what information is retrieved (e.g., metadata, URLs, file sizes) or differentiate from 'get_record' which might also include attachment data.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a record with attachments), contrast with 'get_record' (which might return attachment info as part of a broader record), or indicate scenarios where this specialized tool is preferred over general retrieval methods.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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