Skip to main content
Glama
mrwyndham

PocketBase MCP Server

delete_record

Remove specific records from PocketBase database collections by specifying the collection name and record ID to manage data effectively.

Instructions

Delete a record

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
collectionYesCollection name
idYesRecord ID

Implementation Reference

  • The main handler function for the 'delete_record' tool. It deletes the specified record from the given PocketBase collection and returns a success message or throws an error.
    private async deleteRecord(args: any) {
      try {
        await this.pb.collection(args.collection).delete(args.id);
        return {
          content: [
            {
              type: 'text',
              text: `Successfully deleted record ${args.id} from collection ${args.collection}`,
            },
          ],
        };
      } catch (error: unknown) {
        throw new McpError(
          ErrorCode.InternalError,
          `Failed to delete record: ${pocketbaseErrorMessage(error)}`
        );
      }
    }
  • The input schema defining the required 'collection' and 'id' parameters for the delete_record tool.
    inputSchema: {
      type: 'object',
      properties: {
        collection: {
          type: 'string',
          description: 'Collection name',
        },
        id: {
          type: 'string',
          description: 'Record ID',
        },
      },
      required: ['collection', 'id'],
    },
  • src/index.ts:272-289 (registration)
    The tool registration object including name, description, and input schema, added to the list of tools provided to the MCP server.
    {
      name: 'delete_record',
      description: 'Delete a record',
      inputSchema: {
        type: 'object',
        properties: {
          collection: {
            type: 'string',
            description: 'Collection name',
          },
          id: {
            type: 'string',
            description: 'Record ID',
          },
        },
        required: ['collection', 'id'],
      },
    },
  • src/index.ts:681-682 (registration)
    The switch case in the request handler that routes 'delete_record' calls to the deleteRecord method.
    case 'delete_record':
      return await this.deleteRecord(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