Skip to main content
Glama

list_collections

Retrieve and display all collections within a PocketBase instance, enabling easy access to database structures for record operations and schema management.

Instructions

List all collections in the PocketBase instance.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function for the 'list_collections' tool. It fetches all PocketBase collections sorted by '-created' and returns them as a formatted JSON string in the tool result.
    async function listCollections(args: ListCollectionsArgs, pb: PocketBase): Promise<ToolResult> { // Args are ignored for this tool const result = await pb.collections.getFullList({ sort: '-created' }); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
  • ToolInfo object registering the 'list_collections' tool with its description and input schema (empty object, no args required). Exported via listCollectionTools().
    { name: 'list_collections', description: 'List all collections in the PocketBase instance.', inputSchema: { type: 'object', properties: {}, // No arguments needed additionalProperties: false, }, },
  • TypeScript interface defining the arguments for list_collections tool, which requires no parameters.
    export interface ListCollectionsArgs {} // No arguments
  • Main registration function that includes collection tools (via listCollectionTools()) in the full tools list for the MCP server.
    export function registerTools(): { tools: ToolInfo[] } { // Use ToolInfo[] const tools: ToolInfo[] = [ // Use ToolInfo[] ...listRecordTools(), ...listCollectionTools(), ...listFileTools(), ...listMigrationTools(), // Uncommented ...listLogTools(), // Add log tools ...listCronTools(), // Add cron tools ]; return { tools }; }
  • Routing logic in handleToolCall that directs 'list_collections' calls to the collection tools handler.
    } else if (name === 'get_collection_schema' || name === 'list_collections') { return handleCollectionToolCall(name, toolArgs, 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/mabeldata/pocketbase-mcp'

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