Skip to main content
Glama
mabeldata

PocketBase MCP Server

by mabeldata

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
    ];
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions support for filtering, sorting, pagination, and expansion, but fails to describe critical behaviors: whether this is a read-only operation, what authentication is required, rate limits, error responses, or the structure of returned data. For a tool with 6 parameters and no output schema, this leaves significant gaps in understanding how the tool behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core purpose and enumerates key capabilities without unnecessary words. Every element ('List records from a PocketBase collection. Supports filtering, sorting, pagination, and expansion.') serves a clear informational purpose with zero waste.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (6 parameters, no annotations, no output schema), the description is insufficient. It lacks information about return values, error handling, authentication requirements, and behavioral constraints. While concise, it doesn't provide enough context for an agent to understand the full scope of the tool's operation, especially compared to more complete descriptions that would address these gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with each parameter well-documented in the input schema. The description adds minimal value beyond the schema by naming the supported operations (filtering, sorting, pagination, expansion) but doesn't provide additional context about parameter interactions, default behaviors, or usage examples. This meets the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List records') and resource ('from a PocketBase collection'), making the purpose immediately understandable. It distinguishes itself from siblings like 'fetch_record' (singular retrieval) and 'list_collections' (different resource), though it doesn't explicitly name these alternatives. The mention of filtering, sorting, pagination, and expansion adds specificity about functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for retrieving multiple records with optional query parameters, but provides no explicit guidance on when to use this versus alternatives like 'fetch_record' (for single records) or 'list_collections' (for metadata). There's no mention of prerequisites, error conditions, or performance considerations that would help an agent choose appropriately among siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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