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);

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