Skip to main content
Glama
fadlee

PocketBase MCP Server

by fadlee

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
NameRequiredDescriptionDefault
collectionYesCollection name or ID to delete

Implementation Reference

  • 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),
    },

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

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