get_collection
Retrieve detailed information about a specific collection in a PocketBase database using the Model Context Protocol (MCP). Simplify database schema understanding and management.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_collection"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/agent-worker-compatible.ts:342-360 (handler)Core handler function that executes the get_collection tool logic by fetching collection details from PocketBase using pb.collections.getOne(name)
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}`); } } - src/agent-worker-compatible.ts:122-127 (registration)Tool dispatch/registration in the central switch statement for handling get_collection calls
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); } - src/agent-cloudflare.ts:333-350 (handler)Direct tool registration and inline handler for get_collection in Cloudflare agent implementation
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) }] }; } ); - src/agent-simple.ts:442-469 (handler)Tool registration and inline handler for get_collection in simple agent implementation
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}`); } } ); - src/worker.ts:218-227 (schema)Input schema definition for get_collection tool in worker entry point tools list
name: 'get_collection', description: 'Get details of a specific collection', inputSchema: { type: 'object', properties: { nameOrId: { type: 'string', description: 'Collection name or ID' } }, required: ['nameOrId'] } },