delete_collection
Remove a collection from PocketBase database by specifying its ID or name. This administrative action permanently deletes the collection and its data.
Instructions
Delete a collection from PocketBase (admin only)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collectionIdOrName | Yes | ID or name of the collection to delete |
Implementation Reference
- src/index.ts:1017-1039 (handler)The primary handler function that executes the delete_collection tool. It authenticates as an admin using environment variables, deletes the specified collection via the PocketBase SDK, and returns a success message.private async deleteCollection(args: any) { try { // Authenticate with PocketBase as admin (required for collection deletion) await this.pb.collection("_superusers").authWithPassword(process.env.POCKETBASE_ADMIN_EMAIL ?? '', process.env.POCKETBASE_ADMIN_PASSWORD ?? ''); // Delete the collection await this.pb.collections.delete(args.collectionIdOrName); return { content: [ { type: 'text', text: `Successfully deleted collection ${args.collectionIdOrName}`, }, ], }; } catch (error: unknown) { throw new McpError( ErrorCode.InternalError, `Failed to delete collection: ${pocketbaseErrorMessage(error)}` ); } }
- src/index.ts:654-663 (schema)Input schema definition for the delete_collection tool, specifying the required 'collectionIdOrName' parameter.inputSchema: { type: 'object', properties: { collectionIdOrName: { type: 'string', description: 'ID or name of the collection to delete', }, }, required: ['collectionIdOrName'], },
- src/index.ts:651-664 (registration)Tool registration in the ListTools response, including name, description, and input schema.{ name: 'delete_collection', description: 'Delete a collection from PocketBase (admin only)', inputSchema: { type: 'object', properties: { collectionIdOrName: { type: 'string', description: 'ID or name of the collection to delete', }, }, required: ['collectionIdOrName'], }, },
- src/index.ts:693-694 (registration)Dispatch case in the CallToolRequestSchema handler that routes to the deleteCollection method.case 'delete_collection': return await this.deleteCollection(request.params.arguments);