get_table_schema
Retrieve the complete schema of an Airtable table, including all fields and views, by providing the base ID and table ID or name.
Instructions
Get the full schema for a single table including all fields and views.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appId | Yes | The Airtable base/application ID | |
| tableIdOrName | Yes | The table ID (e.g. "tblXXX") or exact table name | |
| debug | No | When true, include raw Airtable response in output for diagnostics |
Implementation Reference
- The handler function for the get_table_schema tool. It resolves the table by ID or name using client.resolveTable(), then returns a summary with id, name, fields (with id, name, type, typeOptions), and views (with id, name, type).
async get_table_schema({ appId, tableIdOrName, debug }) { const table = await client.resolveTable(appId, tableIdOrName); const summary = { id: table.id, name: table.name, fields: (table.columns || table.fields || []).map(f => ({ id: f.id, name: f.name, type: f.type, typeOptions: f.typeOptions, })), views: (table.views || []).map(v => ({ id: v.id, name: v.name, type: v.type })), }; return ok(summary, table, debug); }, - The input schema definition for the get_table_schema tool, specifying required parameters 'appId' (base ID) and 'tableIdOrName' (table ID or exact name), optional 'debug' flag, and read-only annotations.
name: 'get_table_schema', description: 'Get the full schema for a single table including all fields and views.', annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }, inputSchema: { type: 'object', properties: { appId: { type: 'string', description: 'The Airtable base/application ID' }, tableIdOrName: { type: 'string', description: 'The table ID (e.g. "tblXXX") or exact table name' }, debug: debugProp, }, required: ['appId', 'tableIdOrName'], }, }, - packages/mcp-server/src/tool-config.js:21-21 (registration)Registration of get_table_schema in the TOOL_CATEGORIES map as a 'read' category tool in the MCP server's tool configuration.
get_table_schema: 'read', - packages/extension/src/mcp/tool-profile.ts:35-35 (registration)Registration of get_table_schema in the extension's mirror of TOOL_CATEGORIES for VS Code tool profile management.
get_table_schema: 'read', - The client.resolveTable() helper method used by the handler. It fetches application data via getApplicationData() and resolves a table by ID or name (with ambiguity detection for duplicate names).
async resolveTable(appId, tableIdOrName) { const data = await this.getApplicationData(appId); const tables = data?.data?.tableSchemas || data?.data?.tables || []; // Exact ID match is always unambiguous. const byId = tables.find(t => t.id === tableIdOrName); if (byId) return byId; // Name lookup: collect all matches and reject ambiguous results instead // of silently returning the first one. const byName = tables.filter(t => t.name === tableIdOrName); if (byName.length === 1) return byName[0]; if (byName.length > 1) { const matches = byName.map(t => `${t.name} (${t.id})`).join(', '); throw new Error( `Ambiguous table name "${tableIdOrName}" \u2014 ${byName.length} tables share this name: ${matches}. ` + `Use the table ID to disambiguate.` ); } const available = tables.map(t => `${t.name} (${t.id})`).join(', '); throw new Error(`Table "${tableIdOrName}" not found. Available: ${available}`); }