Skip to main content
Glama
DynamicEndpoints

Advanced PocketBase MCP Server

get_collection

Retrieve collection details from PocketBase databases using the Model Context Protocol. Simplify data management and access structured information for advanced database operations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Inline handler and registration for the 'get_collection' MCP tool. Validates input with Zod schema, ensures PocketBase initialization, fetches collection details using pb.collections.getOne(nameOrId), and returns formatted JSON response.
    this.server.tool( 'get_collection', { description: 'Get details of a specific collection', inputSchema: { nameOrId: z.string().describe('Collection name or ID') } }, async ({ nameOrId }) => { await this.ensureInitialized(); if (!this.pb) { throw new Error('PocketBase not initialized'); } try { const collection = await this.pb.collections.getOne(nameOrId); return { content: [{ type: 'text', text: JSON.stringify(collection, null, 2) }] }; } catch (error: any) { throw new Error(`Failed to get collection: ${error.message}`); } }
  • Inline handler and registration for the 'get_collection' MCP tool in Cloudflare Agent. Fetches specific collection using PocketBase SDK and returns JSON details.
    this.server.tool( "get_collection", "Get details of a specific collection", { nameOrId: z.string().describe('Collection name or ID') }, async ({ nameOrId }) => { if (!this.pb) { throw new Error('PocketBase not initialized'); } const collection = await this.pb.collections.getOne(nameOrId); return { content: [{ type: 'text', text: JSON.stringify(collection, null, 2) }] }; }
  • Core handler function for 'get_collection' tool. Called from switch statement in tool request handler. Retrieves collection info via PocketBase and formats as MCP response.
    private async getCollection(name: string) { if (!this.pb) { throw new Error('PocketBase not configured'); } try { const collection = await this.pb.collections.getOne(name); return { content: [ { type: "text", text: JSON.stringify(collection, null, 2) } ] }; } catch (error: any) { throw new Error(`Failed to get collection: ${error.message}`); }
  • Input schema definition for 'get_collection' tool provided in ListTools response. Specifies required 'name' parameter.
    name: "get_collection", description: "Get detailed information about a specific collection", inputSchema: { type: "object", properties: { name: { type: "string", description: "Collection name" } }, required: ["name"] }
  • Dispatch/registration logic in CallToolRequestHandler switch statement that validates arguments and delegates to getCollection handler.
    case "get_collection": { if (!args || typeof args !== "object" || typeof (args as any).name !== "string") { throw new Error("'name' is required and must be a string for get_collection"); } return await this.getCollection((args as any).name); }

Other Tools

Related 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/DynamicEndpoints/advanced-pocketbase-mcp-server'

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