Skip to main content
Glama
andrewlwn77
by andrewlwn77

upload_attachment

Upload files to NocoDB storage for database attachments. Specify file path and optional storage location to manage file attachments within your database.

Instructions

Upload a file attachment to NocoDB storage

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesPath to the file to upload
storage_pathNoOptional path in NocoDB storage

Implementation Reference

  • The handler function for the 'upload_attachment' tool. It verifies the file exists, gets its stats and name, uploads it using the NocoDB client, and returns success details or error information.
    handler: async (
      client: NocoDBClient,
      args: {
        file_path: string;
        storage_path?: string;
      },
    ) => {
      // Check if file exists
      if (!fs.existsSync(args.file_path)) {
        throw new Error(`File not found: ${args.file_path}`);
      }
    
      const stats = fs.statSync(args.file_path);
      const fileName = path.basename(args.file_path);
    
      try {
        const result = await client.uploadFile(
          args.file_path,
          args.storage_path,
        );
        return {
          success: true,
          file_name: fileName,
          file_size: stats.size,
          upload_result: result,
          message: "File uploaded successfully",
        };
      } catch (error: any) {
        return {
          success: false,
          error: error.message,
          file_path: args.file_path,
        };
      }
    },
  • Input schema defining the parameters for the 'upload_attachment' tool: required 'file_path' and optional 'storage_path'.
    inputSchema: {
      type: "object",
      properties: {
        file_path: {
          type: "string",
          description: "Path to the file to upload",
        },
        storage_path: {
          type: "string",
          description: "Optional path in NocoDB storage",
        },
      },
      required: ["file_path"],
    },
  • The 'upload_attachment' tool is defined as an object in the attachmentTools array, including name, description, inputSchema, and handler.
    {
      name: "upload_attachment",
      description: "Upload a file attachment to NocoDB storage",
      inputSchema: {
        type: "object",
        properties: {
          file_path: {
            type: "string",
            description: "Path to the file to upload",
          },
          storage_path: {
            type: "string",
            description: "Optional path in NocoDB storage",
          },
        },
        required: ["file_path"],
      },
      handler: async (
        client: NocoDBClient,
        args: {
          file_path: string;
          storage_path?: string;
        },
      ) => {
        // Check if file exists
        if (!fs.existsSync(args.file_path)) {
          throw new Error(`File not found: ${args.file_path}`);
        }
    
        const stats = fs.statSync(args.file_path);
        const fileName = path.basename(args.file_path);
    
        try {
          const result = await client.uploadFile(
            args.file_path,
            args.storage_path,
          );
          return {
            success: true,
            file_name: fileName,
            file_size: stats.size,
            upload_result: result,
            message: "File uploaded successfully",
          };
        } catch (error: any) {
          return {
            success: false,
            error: error.message,
            file_path: args.file_path,
          };
        }
      },
    },
  • src/index.ts:55-62 (registration)
    The attachmentTools (containing 'upload_attachment') are combined into the allTools array, which is used by the MCP server to list and execute tools.
    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 for behavioral disclosure. While 'upload' implies a write operation, it doesn't specify permissions required, file size limits, supported formats, error conditions, or what happens on success. For a mutation tool with zero annotation coverage, this leaves significant behavioral gaps.

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, efficient sentence with zero wasted words. It's appropriately sized for a tool with two parameters and gets straight to the point without unnecessary elaboration.

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?

For a mutation tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after upload, what gets returned, error handling, or how this differs from sibling tools. The context demands more completeness for effective tool selection and use.

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?

The schema has 100% description coverage, with both parameters clearly documented in the structured schema. The description adds no additional parameter information beyond what's already in the schema, so it meets the baseline expectation when schema coverage is complete.

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 ('upload') and target ('file attachment to NocoDB storage'), providing a specific verb+resource combination. However, it doesn't distinguish this tool from its sibling 'upload_attachment_by_url', which handles a similar function through a different method.

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 like 'upload_attachment_by_url' or 'attach_file_to_record'. There's no mention of prerequisites, constraints, or appropriate contexts for choosing this specific upload method.

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