Skip to main content
Glama
felores

Airtable MCP Server

by felores

create_table

Add a new table to an Airtable base with custom fields and structure for organizing data.

Instructions

Create a new table in a base

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
base_idYesID of the base
table_nameYesName of the new table
descriptionNoDescription of the table
fieldsNoInitial fields for the table

Implementation Reference

  • The main handler for the 'create_table' tool. It extracts arguments, validates fields using validateField, makes a POST request to Airtable's metadata API to create the table, and returns the response as text.
    case "create_table": {
      const { base_id, table_name, description, fields } = request.params.arguments as {
        base_id: string;
        table_name: string;
        description?: string;
        fields?: FieldOption[];
      };
      
      // Validate and prepare fields
      const validatedFields = fields?.map(field => this.validateField(field));
      
      const response = await this.axiosInstance.post(`/meta/bases/${base_id}/tables`, {
        name: table_name,
        description,
        fields: validatedFields,
      });
      
      return {
        content: [{
          type: "text",
          text: JSON.stringify(response.data, null, 2),
        }],
      };
    }
  • Input schema definition for the 'create_table' tool, including parameters for base_id, table_name, description, and fields array with their types.
    {
      name: "create_table",
      description: "Create a new table in a base",
      inputSchema: {
        type: "object",
        properties: {
          base_id: {
            type: "string",
            description: "ID of the base",
          },
          table_name: {
            type: "string",
            description: "Name of the new table",
          },
          description: {
            type: "string",
            description: "Description of the table",
          },
          fields: {
            type: "array",
            description: "Initial fields for the table",
            items: {
              type: "object",
              properties: {
                name: {
                  type: "string",
                  description: "Name of the field",
                },
                type: {
                  type: "string",
                  description: "Type of the field (e.g., singleLineText, multilineText, number, etc.)",
                },
                description: {
                  type: "string",
                  description: "Description of the field",
                },
                options: {
                  type: "object",
                  description: "Field-specific options",
                },
              },
              required: ["name", "type"],
            },
          },
        },
        required: ["base_id", "table_name"],
      },
    },
  • Helper function used by the create_table handler to validate and normalize field definitions by removing unnecessary options or adding defaults.
    private validateField(field: FieldOption): FieldOption {
      const { type } = field;
    
      // Remove options for fields that don't need them
      if (!fieldRequiresOptions(type as FieldType)) {
        const { options, ...rest } = field;
        return rest;
      }
    
      // Add default options for fields that require them
      if (!field.options) {
        return {
          ...field,
          options: getDefaultOptions(type as FieldType),
        };
      }
    
      return field;
    }
  • TypeScript interface defining the structure of a FieldOption, used in the input schema for fields in create_table.
    export interface FieldOption {
      name: string;
      type: FieldType;
      description?: string;
      options?: Record<string, any>;
    }
  • Helper functions to determine if a field type requires options and to provide default options, used by validateField in the create_table handler.
    export const fieldRequiresOptions = (type: FieldType): boolean => {
      switch (type) {
        case 'number':
        case 'singleSelect':
        case 'multiSelect':
        case 'date':
        case 'currency':
          return true;
        default:
          return false;
      }
    };
    
    export const getDefaultOptions = (type: FieldType): Record<string, any> | undefined => {
      switch (type) {
        case 'number':
          return { precision: 0 };
        case 'date':
          return { dateFormat: { name: 'local' } };
        case 'currency':
          return { precision: 2, symbol: '$' };
        default:
          return undefined;
      }
    };

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

C2.9/5.0
Behavior2/5

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

The description is minimal and does not disclose behavioral traits beyond the core action. With no annotations available, the description should explain aspects like whether the operation is reversible, if it requires specific permissions, or what happens if a table with the same name exists. None of these are addressed.

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, concise sentence that efficiently conveys the tool's purpose. There is no unnecessary information, and it is appropriately front-loaded.

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 absence of an output schema and annotations, the description should cover more contextual aspects such as return values, error conditions, or the effect of optional parameters. The current description is too brief for a tool with four parameters and no output schema, leaving significant gaps in understanding.

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 input schema provides full descriptions for all four parameters, so the baseline is 3. The description does not add additional meaning or context beyond what the schema already offers. For example, it does not clarify how the 'fields' parameter affects the table creation or provide examples.

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 that the tool creates a new table in a base. While it is specific enough to distinguish from tools like 'create_field' or 'create_record', it lacks explicit differentiation that could help an agent immediately decide when to use this tool over similar ones. The verb and resource are clear.

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?

No usage guidelines are provided. The description does not indicate when to use this tool versus alternatives such as 'create_field' or 'update_table'. It also does not mention prerequisites or context where this tool is appropriate.

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