Skip to main content
Glama
andrewlwn77
by andrewlwn77

create_table

Create a new database table with custom columns including SingleSelect, PhoneNumber, QR Code, and Barcode types to organize data in NocoDB.

Instructions

Create a new table in a base with specified columns. Supports various column types including SingleSelect (with options), PhoneNumber, QrCode, and Barcode.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
base_idYesThe ID of the base/project
table_nameYesName of the new table
columnsYesArray of column definitions

Implementation Reference

  • The handler function that implements the core logic of the 'create_table' tool. It uses the NocoDBClient to create a table with the given base_id, table_name, and columns, then returns the created table details.
    handler: async (
      client: NocoDBClient,
      args: {
        base_id: string;
        table_name: string;
        columns: any[];
      },
    ) => {
      const table = await client.createTable(
        args.base_id,
        args.table_name,
        args.columns,
      );
      return {
        table: {
          id: table.id,
          table_name: table.table_name,
          title: table.title,
          type: table.type,
          enabled: table.enabled,
          created_at: table.created_at,
          updated_at: table.updated_at,
        },
        message: `Table '${table.title}' created successfully`,
      };
    },
  • The input schema for the 'create_table' tool, specifying required parameters base_id, table_name, and an array of columns with properties like title, uidt, dt, pk, etc., supporting various column types.
    inputSchema: {
      type: "object",
      properties: {
        base_id: {
          type: "string",
          description: "The ID of the base/project",
        },
        table_name: {
          type: "string",
          description: "Name of the new table",
        },
        columns: {
          type: "array",
          description: "Array of column definitions",
          items: {
            type: "object",
            properties: {
              title: {
                type: "string",
                description: "Column display name",
              },
              column_name: {
                type: "string",
                description: "Column name in database",
              },
              uidt: {
                type: "string",
                description:
                  "UI Data Type - Basic: SingleLineText, LongText, Number, Decimal, Currency, Percent | Date/Time: Date, DateTime, Duration | Boolean: Checkbox | Select: SingleSelect, MultiSelect | Advanced: Attachment, JSON, Email, PhoneNumber, URL, Rating | Virtual/Computed: Formula, Rollup, Lookup, QrCode, Barcode | Relational: Link, Links",
              },
              dt: {
                type: "string",
                description: "Database data type",
              },
              pk: {
                type: "boolean",
                description: "Is primary key",
              },
              rqd: {
                type: "boolean",
                description: "Is required field",
              },
              unique: {
                type: "boolean",
                description: "Is unique constraint",
              },
              ai: {
                type: "boolean",
                description: "Is auto increment",
              },
              meta: {
                type: "object",
                description:
                  "Additional metadata for specific column types (e.g., options for SingleSelect/MultiSelect, reference columns for QrCode/Barcode)",
              },
            },
            required: ["title", "uidt"],
          },
        },
      },
      required: ["base_id", "table_name", "columns"],
    },
  • The complete tool definition object for 'create_table' as part of the exported tableTools array, which defines name, description, inputSchema, and handler.
    {
      name: "create_table",
      description:
        "Create a new table in a base with specified columns. Supports various column types including SingleSelect (with options), PhoneNumber, QrCode, and Barcode.",
      inputSchema: {
        type: "object",
        properties: {
          base_id: {
            type: "string",
            description: "The ID of the base/project",
          },
          table_name: {
            type: "string",
            description: "Name of the new table",
          },
          columns: {
            type: "array",
            description: "Array of column definitions",
            items: {
              type: "object",
              properties: {
                title: {
                  type: "string",
                  description: "Column display name",
                },
                column_name: {
                  type: "string",
                  description: "Column name in database",
                },
                uidt: {
                  type: "string",
                  description:
                    "UI Data Type - Basic: SingleLineText, LongText, Number, Decimal, Currency, Percent | Date/Time: Date, DateTime, Duration | Boolean: Checkbox | Select: SingleSelect, MultiSelect | Advanced: Attachment, JSON, Email, PhoneNumber, URL, Rating | Virtual/Computed: Formula, Rollup, Lookup, QrCode, Barcode | Relational: Link, Links",
                },
                dt: {
                  type: "string",
                  description: "Database data type",
                },
                pk: {
                  type: "boolean",
                  description: "Is primary key",
                },
                rqd: {
                  type: "boolean",
                  description: "Is required field",
                },
                unique: {
                  type: "boolean",
                  description: "Is unique constraint",
                },
                ai: {
                  type: "boolean",
                  description: "Is auto increment",
                },
                meta: {
                  type: "object",
                  description:
                    "Additional metadata for specific column types (e.g., options for SingleSelect/MultiSelect, reference columns for QrCode/Barcode)",
                },
              },
              required: ["title", "uidt"],
            },
          },
        },
        required: ["base_id", "table_name", "columns"],
      },
      handler: async (
        client: NocoDBClient,
        args: {
          base_id: string;
          table_name: string;
          columns: any[];
        },
      ) => {
        const table = await client.createTable(
          args.base_id,
          args.table_name,
          args.columns,
        );
        return {
          table: {
            id: table.id,
            table_name: table.table_name,
            title: table.title,
            type: table.type,
            enabled: table.enabled,
            created_at: table.created_at,
            updated_at: table.updated_at,
          },
          message: `Table '${table.title}' created successfully`,
        };
      },
    },
  • src/index.ts:55-73 (registration)
    In the main MCP server file, tableTools (including create_table) is imported and spread into allTools, which is then used to register the tools list handler for the MCP protocol.
    const allTools = [
      ...databaseTools,
      ...tableTools,
      ...recordTools,
      ...viewTools,
      ...queryTools,
      ...attachmentTools,
    ];
    
    // Register handlers
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: allTools.map((tool) => ({
          name: tool.name,
          description: tool.description,
          inputSchema: tool.inputSchema,
        })),
      };
    });
  • src/index.ts:75-103 (registration)
    The MCP call tool handler that dispatches to the specific tool handler (like create_table's) based on name from allTools.
    server.setRequestHandler(CallToolRequestSchema, async (request) => {
      const { name, arguments: args } = request.params;
    
      const tool = allTools.find((t) => t.name === name);
      if (!tool) {
        throw new McpError(ErrorCode.MethodNotFound, `Tool ${name} not found`);
      }
    
      try {
        const result = await tool.handler(nocodb, args);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      } catch (error) {
        if (error instanceof NocoDBError) {
          throw new McpError(
            ErrorCode.InternalError,
            `NocoDB error: ${error.message}`,
            error.details,
          );
        }
        throw error;
      }
    });
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While it mentions support for various column types, it doesn't describe critical behavioral aspects: whether this operation is idempotent, what permissions are required, how errors are handled, whether the table name must be unique, or what the response looks like. For a mutation tool with zero annotation coverage, this leaves significant gaps in understanding the tool's behavior.

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

Conciseness4/5

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

The description is a single, efficient sentence that states the core purpose upfront. It avoids unnecessary words and gets straight to the point. However, it could be slightly more structured by separating the core action from the column type examples for better readability.

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 this is a mutation tool (creates a table) with no annotations, no output schema, and 3 required parameters, the description is incomplete. It doesn't address behavioral aspects like error handling, permissions, or response format. While the schema covers parameters well, the overall context for using this tool safely and effectively is insufficient.

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%, so the schema already documents all three parameters thoroughly. The description adds minimal value beyond the schema by mentioning specific column types (SingleSelect, PhoneNumber, QrCode, Barcode) as examples, but doesn't provide additional syntax, format details, or constraints beyond what's in the schema. This meets the baseline for high schema coverage.

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 ('Create a new table') and resource ('in a base with specified columns'), providing a specific verb+resource combination. It distinguishes from siblings by focusing on table creation rather than column operations (add_column), data operations (insert_record), or table deletion (delete_table). However, it doesn't explicitly differentiate from similar tools like create_view, which is why it doesn't achieve a perfect score.

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 an existing base), when to choose create_table over create_view, or any exclusions. The agent must infer usage from the tool name and description alone, which is insufficient for optimal tool selection.

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