Skip to main content
Glama
mrwyndham

PocketBase MCP Server

list_records

Retrieve and manage records from a specified collection with customizable filters, sorting, and pagination options for efficient database queries.

Instructions

List records from a collection with optional filters

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesCollection name
filterNoFilter query
pageNoPage number
perPageNoItems per page
sortNoSort field and direction

Implementation Reference

  • The function that executes the list_records tool logic: fetches records from the specified PocketBase collection using getList with optional filter, sort, pagination.
    private async listRecords(args: any) { try { const options: any = {}; if (args.filter) options.filter = args.filter; if (args.sort) options.sort = args.sort; if (args.page) options.page = args.page; if (args.perPage) options.perPage = args.perPage; const result = await this.pb.collection(args.collection).getList( options.page || 1, options.perPage || 50, { filter: options.filter, sort: options.sort, } ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error: unknown) { throw new McpError( ErrorCode.InternalError, `Failed to list records: ${pocketbaseErrorMessage(error)}` ); } }
  • Input schema defining parameters for list_records: required collection name, optional filter, sort, page, perPage.
    inputSchema: { type: 'object', properties: { collection: { type: 'string', description: 'Collection name', }, filter: { type: 'string', description: 'Filter query', }, sort: { type: 'string', description: 'Sort field and direction', }, page: { type: 'number', description: 'Page number', }, perPage: { type: 'number', description: 'Items per page', }, }, required: ['collection'], },
  • src/index.ts:220-249 (registration)
    Tool registration in the ListTools response, including name, description, and input schema.
    { name: 'list_records', description: 'List records from a collection with optional filters', inputSchema: { type: 'object', properties: { collection: { type: 'string', description: 'Collection name', }, filter: { type: 'string', description: 'Filter query', }, sort: { type: 'string', description: 'Sort field and direction', }, page: { type: 'number', description: 'Page number', }, perPage: { type: 'number', description: 'Items per page', }, }, required: ['collection'], }, },
  • src/index.ts:677-678 (registration)
    Dispatcher case in CallToolRequestSchema handler that routes list_records calls to the listRecords method.
    case 'list_records': return await this.listRecords(request.params.arguments);

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/mrwyndham/pocketbase-mcp'

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