Skip to main content
Glama
fadlee

PocketBase MCP Server

by fadlee

list_collections

Retrieve all collections from a PocketBase database with customizable sorting options to organize and manage your data structure.

Instructions

List all collections with optional sorting

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sortNoSort order for collections (e.g., '-created', 'name')-created

Implementation Reference

  • The handler function that creates and returns the ToolHandler for listing collections. It uses PocketBase's collections.getFullList() with optional sorting.
    export function createListCollectionsHandler(pb: PocketBase): ToolHandler { return async (args: { sort?: string }) => { try { const result = await pb.collections.getFullList({ sort: args.sort || "-created" }); return createJsonResponse(result); } catch (error: unknown) { throw handlePocketBaseError("list collections", error); } }; }
  • Zod-like input schema definition for the list_collections tool, defining an optional 'sort' property.
    export const listCollectionsSchema = { type: "object", properties: { sort: { type: "string", description: "Sort order for collections (e.g., '-created', 'name')", default: "-created", }, }, required: [], };
  • src/server.ts:111-116 (registration)
    The tool registration object in the MCP server array, linking the name, description, schema, and handler for list_collections.
    { name: "list_collections", description: "List all collections with optional sorting", inputSchema: listCollectionsSchema, handler: createListCollectionsHandler(pb), },

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

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