delete_record
Remove a specific record from a PocketBase collection by providing the collection name and record ID to manage database content.
Instructions
Delete a record
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| collection | Yes | Collection name | |
| id | Yes | Record ID |
Implementation Reference
- src/tools/handlers/record.ts:91-103 (handler)Factory function that creates the ToolHandler for the delete_record tool, which deletes the specified record from a PocketBase collection.export function createDeleteRecordHandler(pb: PocketBase): ToolHandler { return async (args: DeleteRecordArgs) => { try { await pb.collection(args.collection).delete(args.id); return createJsonResponse({ success: true, message: `Record '${args.id}' deleted successfully from collection '${args.collection}'` }); } catch (error: unknown) { throw handlePocketBaseError("delete record", error); } }; }
- src/tools/schemas/record.ts:94-107 (schema)JSON Schema for input validation of the delete_record tool, requiring 'collection' and 'id' parameters.export const deleteRecordSchema = { type: "object", properties: { collection: { type: "string", description: "Collection name", }, id: { type: "string", description: "Record ID", }, }, required: ["collection", "id"], };
- src/server.ts:144-148 (registration)Registers the delete_record tool in the MCP server with its name, description, input schema, and handler function.name: "delete_record", description: "Delete a record", inputSchema: deleteRecordSchema, handler: createDeleteRecordHandler(pb), },
- src/types/index.ts:110-113 (schema)TypeScript interface defining the input arguments for the delete_record handler.export interface DeleteRecordArgs { collection: string; id: string; }