validate_formula
Check a formula expression for validity and determine its result type (text, number, etc.) before creating or updating a formula field in Airtable.
Instructions
Validate a formula expression before creating or updating a formula field. Returns whether the formula is valid and what result type it produces (text, number, etc). Use this before create/update to catch errors early.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| appId | Yes | The Airtable base/application ID | |
| tableId | Yes | The table ID where the formula will be used | |
| formulaText | Yes | The formula expression to validate | |
| debug | No | When true, include raw Airtable response in output for diagnostics |
Implementation Reference
- The MCP tool handler for 'validate_formula'. Receives appId, tableId, formulaText from the LLM, delegates to client.validateFormula(), and returns the result (valid + resultType or error).
async validate_formula({ appId, tableId, formulaText, debug }) { const result = await client.validateFormula(appId, tableId, formulaText); return ok(result, result, debug); }, - The tool definition / input schema for 'validate_formula'. Declares three required parameters (appId, tableId, formulaText) and an optional debug flag.
{ name: 'validate_formula', description: 'Validate a formula expression before creating or updating a formula field. Returns whether the formula is valid and what result type it produces (text, number, etc). Use this before create/update to catch errors early.', annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false }, inputSchema: { type: 'object', properties: { appId: { type: 'string', description: 'The Airtable base/application ID' }, tableId: { type: 'string', description: 'The table ID where the formula will be used' }, formulaText: { type: 'string', description: 'The formula expression to validate' }, debug: debugProp, }, required: ['appId', 'tableId', 'formulaText'], }, }, - packages/mcp-server/src/tool-config.js:25-25 (registration)Tool registration in TOOL_CATEGORIES — tagged as 'read' category (read-only/inspection tool).
validate_formula: 'read', - The AirtableClient method that executes the actual HTTP call to Airtable's internal API (POST /v0.3/table/{tableId}/getUnsavedColumnConfigResultType). Returns { valid: boolean, resultType: string|null } or { valid: false, error, message } on failure.
async validateFormula(appId, tableId, formulaText) { assertAirtableId(appId, 'appId'); assertAirtableId(tableId, 'tableId'); const url = `https://airtable.com/v0.3/table/${tableId}/getUnsavedColumnConfigResultType`; const payload = { config: { default: null, type: 'formula', typeOptions: { formulaText }, }, }; const res = await this.auth.postForm(url, this._mutationParams(payload, appId), appId); const data = await res.json().catch(() => null); if (!res.ok) { return { valid: false, error: data?.error?.type || `HTTP ${res.status}`, message: data?.error?.message || 'Formula validation failed', }; } return { valid: data?.data?.pass === true, resultType: data?.data?.resultType || null, }; } - packages/extension/src/mcp/tool-profile.ts:39-39 (registration)Mirror registration in the VS Code extension's tool-profile config (must stay in sync with tool-config.js).
validate_formula: 'read',