Skip to main content
Glama

list_records

Retrieve records from a PocketBase collection with customizable filters, sorting, pagination, and expansion for precise data access.

Instructions

List records from a PocketBase collection. Supports filtering, sorting, pagination, and expansion.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesThe name or ID of the PocketBase collection.
expandNoPocketBase expand string (e.g., "user,tags.name").
filterNoPocketBase filter string (e.g., "status='active'").
pageNoPage number (defaults to 1).
perPageNoItems per page (defaults to 30, max 500).
sortNoPocketBase sort string (e.g., "-created,name").

Implementation Reference

  • The main handler function for the 'list_records' tool, which fetches a list of records from a PocketBase collection using getList with optional pagination, filtering, sorting, and expansion.
    async function listRecords(args: ListRecordsArgs, pb: PocketBase): Promise<ToolResult> { if (!args.collection) { throw invalidParamsError("Missing required argument: collection"); } const { collection, page = 1, perPage = 30, filter, sort, expand } = args; const result = await pb.collection(collection).getList(page, perPage, { filter, sort, expand }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • The ToolInfo object defining the schema, description, and input parameters for the 'list_records' tool.
    { name: 'list_records', description: 'List records from a PocketBase collection. Supports filtering, sorting, pagination, and expansion.', inputSchema: { type: 'object', properties: { collection: { type: 'string', description: 'The name or ID of the PocketBase collection.' }, page: { type: 'number', description: 'Page number (defaults to 1).', minimum: 1 }, perPage: { type: 'number', description: 'Items per page (defaults to 30, max 500).', minimum: 1, maximum: 500 }, filter: { type: 'string', description: 'PocketBase filter string (e.g., "status=\'active\'").' }, sort: { type: 'string', description: 'PocketBase sort string (e.g., "-created,name").' }, expand: { type: 'string', description: 'PocketBase expand string (e.g., "user,tags.name").' } }, required: ['collection'], }, },
  • TypeScript interface defining the input arguments for the 'list_records' tool.
    export interface ListRecordsArgs { collection: string; page?: number; perPage?: number; filter?: string; sort?: string; expand?: string; }
  • Dispatch logic in handleToolCall that routes 'list_records' calls to the record tools handler.
    if (name === 'fetch_record' || name === 'list_records' || name === 'create_record' || name === 'update_record') { return handleRecordToolCall(name, toolArgs, pb); } else if (name === 'get_collection_schema' || name === 'list_collections') {
  • Registration of record tools (including list_records) in the main registerTools function via spread of listRecordTools().
    const tools: ToolInfo[] = [ // Use ToolInfo[] ...listRecordTools(), ...listCollectionTools(), ...listFileTools(), ...listMigrationTools(), // Uncommented ...listLogTools(), // Add log tools ...listCronTools(), // Add cron 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/mabeldata/pocketbase-mcp'

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