list_collections
Retrieve all available collections from a PocketBase database to manage data structure and access records.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/agent-cloudflare.ts:313-330 (handler)Inline handler function for the 'list_collections' MCP tool. Fetches all PocketBase collections using pb.collections.getFullList() and returns them as JSON text content.this.server.tool( "list_collections", "List all collections in the PocketBase database", {}, async () => { if (!this.pb) { throw new Error('PocketBase not initialized. Please configure POCKETBASE_URL.'); } const collections = await this.pb.collections.getFullList(); return { content: [{ type: 'text', text: JSON.stringify(collections, null, 2) }] }; } );
- src/agent-simple.ts:417-440 (handler)Inline handler function for the 'list_collections' MCP tool in agent-simple. Ensures initialization, fetches PocketBase collections, and returns JSON.this.server.tool( 'list_collections', { description: 'List all collections in the PocketBase database' }, async () => { await this.ensureInitialized(); if (!this.pb) { throw new Error('PocketBase not initialized'); } try { const collections = await this.pb.collections.getFullList(); return { content: [{ type: 'text', text: JSON.stringify(collections, null, 2) }] }; } catch (error: any) { throw new Error(`Failed to list collections: ${error.message}`); } } );
- src/agent-worker-compatible.ts:319-337 (handler)Private handler method listCollections() called by the 'list_collections' tool switch case. Fetches and returns all PocketBase collections as JSON text.private async listCollections() { if (!this.pb) { throw new Error('PocketBase not configured'); } try { const collections = await this.pb.collections.getFullList(); return { content: [ { type: "text", text: JSON.stringify(collections, null, 2) } ] }; } catch (error: any) { throw new Error(`Failed to list collections: ${error.message}`); } }
- Input schema definition for the 'list_collections' tool (empty object, no parameters required).name: "list_collections", description: "List all PocketBase collections", inputSchema: { type: "object", properties: {}, required: [] } },
- src/agent-worker-compatible.ts:119-121 (registration)Tool dispatch registration in switch statement for CallToolRequestSchema handler, delegating to listCollections() method.case "list_collections": return await this.listCollections();