search_records
Search for database records using a query string to find specific information within NocoDB tables. Apply filters, sorting, and pagination to refine results.
Instructions
Search for records containing a query string
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 | |
| query | Yes | Search query string | |
| where | No | Additional filter condition | |
| sort | No | Sort fields | |
| limit | No | Number of records to return | |
| offset | No | Number of records to skip |
Implementation Reference
- src/tools/record.ts:319-349 (handler)MCP tool handler for 'search_records' that invokes NocoDBClient.searchRecords with provided arguments and formats the response.handler: async ( client: NocoDBClient, args: { base_id: string; table_name: string; query: string; where?: string; sort?: string; limit?: number; offset?: number; }, ) => { const result = await client.searchRecords( args.base_id, args.table_name, args.query, { where: args.where, sort: args.sort, limit: args.limit, offset: args.offset, }, ); return { records: result.list, pageInfo: result.pageInfo, count: result.list.length, query: args.query, }; }, },
- src/tools/record.ts:285-318 (schema)Input schema defining parameters for the 'search_records' tool.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", }, query: { type: "string", description: "Search query string", }, where: { type: "string", description: "Additional filter condition", }, sort: { type: "string", description: "Sort fields", }, limit: { type: "number", description: "Number of records to return", }, offset: { type: "number", description: "Number of records to skip", }, }, required: ["base_id", "table_name", "query"], },
- src/index.ts:55-62 (registration)Includes recordTools (containing 'search_records') in the allTools array registered with MCP server handlers for list and call requests.const allTools = [ ...databaseTools, ...tableTools, ...recordTools, ...viewTools, ...queryTools, ...attachmentTools, ];
- src/nocodb-api.ts:325-340 (helper)NocoDBClient.searchRecords method implementing client-side fuzzy search by fetching records and filtering those containing the query string.async searchRecords( baseId: string, tableName: string, query: string, options?: QueryOptions, ): Promise<{ list: NocoDBRecord[]; pageInfo: any }> { // For now, use regular list with client-side filtering // since NocoDB search syntax is complex const records = await this.listRecords(baseId, tableName, options); const filtered = records.list.filter((record) => { return Object.values(record).some((value) => String(value).toLowerCase().includes(query.toLowerCase()), ); }); return { list: filtered, pageInfo: records.pageInfo }; }