list_records
Retrieve records from a NocoDB table with filtering, sorting, and pagination options to manage and query database data.
Instructions
List records from a table with optional filtering, sorting, and pagination
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base_id | Yes | The ID of the base/project | |
| table_name | Yes | The name of the table | |
| where | No | Filter condition (e.g., "(status,eq,active)") | |
| sort | No | Sort fields (prefix with - for descending, e.g., "-created_at") | |
| fields | No | Comma-separated list of fields to return | |
| limit | No | Number of records to return (default: 25) | |
| offset | No | Number of records to skip | |
| view_id | No | View ID to use for filtering |
Implementation Reference
- src/tools/record.ts:171-197 (handler)The handler function for the 'list_records' MCP tool. It takes the tool arguments and forwards them to the NocoDBClient's listRecords method, returning the records, pageInfo, and count.handler: async ( client: NocoDBClient, args: { base_id: string; table_name: string; where?: string; sort?: string; fields?: string; limit?: number; offset?: number; view_id?: string; }, ) => { const result = await client.listRecords(args.base_id, args.table_name, { where: args.where, sort: args.sort, fields: args.fields, limit: args.limit, offset: args.offset, viewId: args.view_id, }); return { records: result.list, pageInfo: result.pageInfo, count: result.list.length, }; },
- src/tools/record.ts:132-170 (schema)The input schema for the 'list_records' tool, defining required base_id and table_name, and optional filtering, sorting, pagination parameters.inputSchema: { type: "object", properties: { base_id: { type: "string", description: "The ID of the base/project", }, table_name: { type: "string", description: "The name of the table", }, where: { type: "string", description: 'Filter condition (e.g., "(status,eq,active)")', }, sort: { type: "string", description: 'Sort fields (prefix with - for descending, e.g., "-created_at")', }, fields: { type: "string", description: "Comma-separated list of fields to return", }, limit: { type: "number", description: "Number of records to return (default: 25)", }, offset: { type: "number", description: "Number of records to skip", }, view_id: { type: "string", description: "View ID to use for filtering", }, }, required: ["base_id", "table_name"], },
- src/index.ts:55-62 (registration)Registration of the recordTools (including list_records) by spreading into the allTools array used for MCP server tool listing and execution.const allTools = [ ...databaseTools, ...tableTools, ...recordTools, ...viewTools, ...queryTools, ...attachmentTools, ];