Skip to main content
Glama

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
NameRequiredDescriptionDefault
filterNoFilter criteria
maxRecordsNoMaximum number of records to return. Defaults to 100.
resourceUriYesURI of the resource to query
sortNoSpecifies how to sort the records

Implementation Reference

  • 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; }); }
  • 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), },
  • 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'), });

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kbhuw/MCP_TEMPLATE'

If you have feedback or need assistance with the MCP directory API, please join our Discord server