quickbase_query_records
Retrieve and filter records from a QuickBase table using specific criteria, select fields, and apply sorting for efficient data management. Simplify querying with customizable options.
Instructions
Query records from a table with optional filtering and sorting
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| select | No | Field IDs to select | |
| skip | No | Number of records to skip | |
| sortBy | No | Sort criteria | |
| tableId | Yes | Table ID to query | |
| top | No | Max number of records | |
| where | No | QuickBase query filter (e.g., "{6.EX.'John'}") |
Implementation Reference
- src/quickbase/client.ts:143-167 (handler)Core implementation of the quickbase_query_records tool. Constructs query parameters from options and calls QuickBase /records/query API endpoint.async getRecords(tableId: string, options?: QueryOptions): Promise<any[]> { const params: any = { from: tableId }; if (options?.select) { params.select = options.select; } if (options?.where) { params.where = options.where; } if (options?.sortBy) { params.sortBy = options.sortBy; } if (options?.groupBy) { params.groupBy = options.groupBy; } if (options?.top) { params.top = options.top; } if (options?.skip) { params.skip = options.skip; } const response = await this.axios.post('/records/query', params); return response.data.data; }
- src/index.ts:211-229 (registration)MCP server dispatch handler for quickbase_query_records tool call, validates args and invokes QuickBaseClient.getRecords.case 'quickbase_query_records': if (!args || typeof args !== 'object') { throw new Error('Invalid arguments'); } const records = await this.qbClient.getRecords(args.tableId as string, { select: args.select as number[], where: args.where as string, sortBy: args.sortBy as any[], top: args.top as number, skip: args.skip as number }); return { content: [ { type: 'text', text: JSON.stringify(records, null, 2), }, ], };
- src/tools/index.ts:241-265 (schema)Tool definition and JSON input schema for quickbase_query_records, used for MCP tool listing and validation.name: 'quickbase_query_records', description: 'Query records from a table with optional filtering and sorting', inputSchema: { type: 'object', properties: { tableId: { type: 'string', description: 'Table ID to query' }, select: { type: 'array', items: { type: 'number' }, description: 'Field IDs to select' }, where: { type: 'string', description: 'QuickBase query filter (e.g., "{6.EX.\'John\'}")' }, sortBy: { type: 'array', items: { type: 'object', properties: { fieldId: { type: 'number' }, order: { type: 'string', enum: ['ASC', 'DESC'] } } }, description: 'Sort criteria' }, top: { type: 'number', description: 'Max number of records' }, skip: { type: 'number', description: 'Number of records to skip' } }, required: ['tableId'] } },
- src/tools/index.ts:35-45 (schema)Zod schema for input validation of quickbase_query_records parameters (QueryRecordsSchema).const QueryRecordsSchema = z.object({ tableId: z.string().describe('Table ID to query'), select: z.array(z.number()).optional().describe('Field IDs to select'), where: z.string().optional().describe('QuickBase query filter'), sortBy: z.array(z.object({ fieldId: z.number(), order: z.enum(['ASC', 'DESC']).default('ASC') })).optional().describe('Sort criteria'), top: z.number().optional().describe('Max number of records'), skip: z.number().optional().describe('Number of records to skip') });