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
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/collection-tools.ts:61-67 (handler)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) }], }; }
- src/tools/collection-tools.ts:21-29 (registration)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, }, },
- src/types/tool-types.ts:73-73 (schema)TypeScript interface defining the arguments for list_collections tool, which requires no parameters.export interface ListCollectionsArgs {} // No arguments
- src/tools/index.ts:15-25 (registration)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 }; }
- src/tools/index.ts:47-48 (registration)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);