Skip to main content
Glama
mrwyndham

PocketBase MCP Server

delete_collection

Remove a specific collection from a PocketBase database by specifying its ID or name. Designed for admin use, this tool simplifies database schema management and cleanup.

Instructions

Delete a collection from PocketBase (admin only)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionIdOrNameYesID or name of the collection to delete

Implementation Reference

  • The main handler function for the delete_collection tool. Authenticates as PocketBase admin and deletes the specified collection using pb.collections.delete.
    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)}` ); } }
  • Input schema for delete_collection tool, defining 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)
    Registration of the delete_collection tool in the ListToolsRequestSchema response, including name, description, and 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/registration case in the CallToolRequestSchema handler that calls the deleteCollection method.
    case 'delete_collection': return await this.deleteCollection(request.params.arguments);

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/mrwyndham/pocketbase-mcp'

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