quickbase_create_field
Add a new field to a QuickBase table, specifying the field type, label, and attributes such as required or unique, to enhance data organization and structure.
Instructions
Create a new field in a table
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| choices | No | Choices for choice fields | |
| fieldType | Yes | Type of field | |
| formula | No | Formula for formula fields | |
| label | Yes | Field label/name | |
| lookupFieldId | No | Field ID for lookup fields | |
| lookupTableId | No | Table ID for lookup fields | |
| required | No | Whether field is required | |
| tableId | Yes | Table ID to add field to | |
| unique | No | Whether field must be unique |
Implementation Reference
- src/quickbase/client.ts:98-126 (handler)Core handler function that executes the QuickBase API call to create a new field, handling field types, properties, choices, formulas, and lookups.async createField(tableId: string, field: QuickBaseField): Promise<number> { const fieldData: any = { tableId, label: field.label, fieldType: field.fieldType, required: field.required, unique: field.unique }; // Add field-specific properties if (field.choices && ['text_choice', 'multiselect'].includes(field.fieldType)) { fieldData.properties = { choices: field.choices }; } if (field.formula && field.fieldType === 'formula') { fieldData.formula = field.formula; } if (field.lookupReference && field.fieldType === 'lookup') { fieldData.properties = { lookupReference: field.lookupReference }; } const response = await this.axios.post('/fields', fieldData); return response.data.id; }
- src/tools/index.ts:19-33 (schema)Zod schema for validating input parameters to the quickbase_create_field tool.const CreateFieldSchema = z.object({ tableId: z.string().describe('Table ID to add field to'), label: z.string().describe('Field label/name'), fieldType: z.enum([ 'text', 'text_choice', 'text_multiline', 'richtext', 'numeric', 'currency', 'percent', 'date', 'datetime', 'checkbox', 'email', 'phone', 'url', 'address', 'file', 'lookup', 'formula', 'reference' ]).describe('Type of field'), required: z.boolean().default(false).describe('Whether field is required'), unique: z.boolean().default(false).describe('Whether field must be unique'), choices: z.array(z.string()).optional().describe('Choices for choice fields'), formula: z.string().optional().describe('Formula for formula fields'), lookupTableId: z.string().optional().describe('Table ID for lookup fields'), lookupFieldId: z.number().optional().describe('Field ID for lookup fields') });
- src/tools/index.ts:186-208 (registration)MCP tool registration including name, description, and input schema for listTools response.{ name: 'quickbase_create_field', description: 'Create a new field in a table', inputSchema: { type: 'object', properties: { tableId: { type: 'string', description: 'Table ID to add field to' }, label: { type: 'string', description: 'Field label/name' }, fieldType: { type: 'string', enum: ['text', 'text_choice', 'text_multiline', 'richtext', 'numeric', 'currency', 'percent', 'date', 'datetime', 'checkbox', 'email', 'phone', 'url', 'address', 'file', 'lookup', 'formula', 'reference'], description: 'Type of field' }, required: { type: 'boolean', description: 'Whether field is required', default: false }, unique: { type: 'boolean', description: 'Whether field must be unique', default: false }, choices: { type: 'array', items: { type: 'string' }, description: 'Choices for choice fields' }, formula: { type: 'string', description: 'Formula for formula fields' }, lookupTableId: { type: 'string', description: 'Table ID for lookup fields' }, lookupFieldId: { type: 'number', description: 'Field ID for lookup fields' } }, required: ['tableId', 'label', 'fieldType'] } },
- src/index.ts:153-177 (handler)MCP server dispatch handler for the tool call, parsing arguments and invoking the QuickBaseClient.createField method.case 'quickbase_create_field': if (!args || typeof args !== 'object') { throw new Error('Invalid arguments'); } const fieldId = await this.qbClient.createField(args.tableId as string, { label: args.label as string, fieldType: args.fieldType as any, required: (args.required as boolean) || false, unique: (args.unique as boolean) || false, choices: args.choices as string[], formula: args.formula as string, lookupReference: args.lookupTableId ? { tableId: args.lookupTableId as string, fieldId: args.lookupFieldId as number } : undefined }); return { content: [ { type: 'text', text: `Field created with ID: ${fieldId}`, }, ], };