list_records
Retrieve and filter records from a specified resource URI, set a maximum number of results, and sort data using customizable criteria for structured querying.
Instructions
List records from a resource
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | Filter criteria | |
| maxRecords | No | Maximum number of records to return. Defaults to 100. | |
| resourceUri | Yes | URI of the resource to query | |
| sort | No | Specifies how to sort the records |
Implementation Reference
- src/core/MCPServer.ts:175-188 (handler)Handler implementation for the 'list_records' tool. Validates input arguments using ListRecordsArgsSchema and queries the data service for records with optional filtering and sorting.case 'list_records': { return await safeExecute(toolName, async () => { const args = validateInput(ListRecordsArgsSchema, request.params.arguments); const records = await this.dataService.queryResource( args.resourceUri, { maxRecords: args.maxRecords, filter: args.filter, sort: args.sort, } ); return records; }); }
- src/core/MCPServer.ts:133-137 (registration)Registration of the 'list_records' tool in the handleListTools method, specifying name, description, and input schema.{ name: 'list_records', description: 'List records from a resource', inputSchema: getInputSchema(ListRecordsArgsSchema), },
- src/types/index.ts:67-75 (schema)Zod schema defining the input arguments for the 'list_records' tool, including resource URI, optional max records, filter, and sort options.export const ListRecordsArgsSchema = z.object({ resourceUri: z.string().describe('URI of the resource to query'), maxRecords: z.number().optional().describe('Maximum number of records to return. Defaults to 100.'), filter: z.record(z.unknown()).optional().describe('Filter criteria'), sort: z.array(z.object({ field: z.string().describe('Field name to sort by'), direction: z.enum(['asc', 'desc']).optional().describe('Sort direction. Defaults to asc (ascending)'), })).optional().describe('Specifies how to sort the records'), });