Skip to main content
Glama
create-table.ts1.1 kB
import type {McpServer} from '@modelcontextprotocol/sdk/server/mcp.js'; import {z} from 'zod'; import type {ToolContext} from './types.js'; import {baseId} from './schemas.js'; import {jsonResult} from '../utils/response.js'; const outputSchema = z.object({ table: z.record(z.string(), z.unknown()), }); export function registerCreateTable(server: McpServer, ctx: ToolContext): void { server.registerTool( 'create_table', { title: 'Create Table', description: 'Create a new table in a base', inputSchema: { ...baseId, name: z.string().describe('The name of the table'), fields: z.array(z.record(z.string(), z.unknown())).describe('Array of field definitions'), description: z.string().optional().describe('Optional description for the table'), }, outputSchema, annotations: { readOnlyHint: false, }, }, async (args) => { const table = await ctx.airtableService.createTable( args.baseId, args.name, args.fields as {name: string; type: string}[], args.description, ); return jsonResult(outputSchema.parse({table})); }, ); }

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/domdomegg/airtable-mcp-server'

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