delete_collection
Remove a collection from PocketBase by specifying its name or ID. This tool helps manage database structure by eliminating unwanted collections and their associated data.
Instructions
Delete a collection from PocketBase
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection | Yes | Collection name or ID to delete |
Implementation Reference
- src/tools/handlers/collection.ts:25-36 (handler)The handler function that performs the deletion of a PocketBase collection using pb.collections.delete() and returns a success message or throws handled errors.export function createDeleteCollectionHandler(pb: PocketBase): ToolHandler { return async (args: { collection: string }) => { try { await pb.collections.delete(args.collection); return createJsonResponse({ success: true, message: `Collection '${args.collection}' deleted successfully` }); } catch (error: unknown) { throw handlePocketBaseError("delete collection", error); } };
- The input schema for the delete_collection tool, requiring a 'collection' string parameter.export const deleteCollectionSchema = { type: "object", properties: { collection: { type: "string", description: "Collection name or ID to delete", }, }, required: ["collection"], };
- src/server.ts:99-104 (registration)The registration of the 'delete_collection' tool in the MCP server, specifying name, description, input schema, and handler.{ name: "delete_collection", description: "Delete a collection from PocketBase", inputSchema: deleteCollectionSchema, handler: createDeleteCollectionHandler(pb), },