Skip to main content
Glama
mrwyndham

PocketBase MCP Server

list_collections

Retrieve all collections from PocketBase databases with optional filtering and sorting to manage database schema and organize data structures.

Instructions

List all collections in PocketBase

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNoFilter query for collections
sortNoSort order for collections

Implementation Reference

  • The handler function that authenticates as admin and lists PocketBase collections using filter or sort options if provided, returning JSON-formatted list.
    private async listCollections(args: any) {
      try {
        // Authenticate with PocketBase
        await this.pb.collection("_superusers").authWithPassword(process.env.POCKETBASE_ADMIN_EMAIL ?? '', process.env.POCKETBASE_ADMIN_PASSWORD ?? '');
    
        // Fetch collections based on provided arguments
        let collections;
        if (args.filter) {
          collections = await this.pb.collections.getFirstListItem(args.filter);
        } else if (args.sort) {
          collections = await this.pb.collections.getFullList({ sort: args.sort });
        } else {
          collections = await this.pb.collections.getList(1, 100);
        }
    
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(collections, null, 2),
            },
          ],
        };
      } catch (error: unknown) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to list collections: ${pocketbaseErrorMessage(error)}`
        );
      }
    }
  • src/index.ts:634-650 (registration)
    Registration of the 'list_collections' tool in the ListTools response, including description and input schema.
    {
      name: 'list_collections',
      description: 'List all collections in PocketBase',
      inputSchema: {
        type: 'object',
        properties: {
          filter: {
            type: 'string',
            description: 'Filter query for collections',
          },
          sort: {
            type: 'string',
            description: 'Sort order for collections',
          },
        },
      },
    },
  • src/index.ts:691-692 (registration)
    Dispatcher in CallToolRequest handler that routes 'list_collections' calls to the listCollections method.
    case 'list_collections':
      return await this.listCollections(request.params.arguments);
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 states it's a list operation, implying read-only behavior, but doesn't mention potential side effects, authentication requirements, rate limits, pagination, or return format. For a tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 with zero wasted words. It's appropriately sized for a simple list operation and front-loads the core purpose immediately, making it easy to parse quickly.

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

Completeness3/5

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

Given the tool's low complexity (a list operation with 2 optional parameters) and 100% schema coverage, the description is minimally adequate. However, with no output schema and no annotations, it should ideally mention the return type or format to be more complete, but it's not critically lacking for this simple case.

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?

The input schema has 100% description coverage, with both parameters ('filter' and 'sort') documented in the schema. The description adds no additional parameter semantics beyond what's already in the schema, so it meets the baseline of 3 where the schema does the heavy lifting.

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 all collections') and resource ('in PocketBase'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'get_collection' or 'create_collection', which would require explicit comparison to achieve a score of 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'get_collection' (for a single collection) or 'create_collection' (for creating new ones). There's no mention of prerequisites, context, or exclusions, leaving usage entirely implied from the tool name alone.

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

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