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
| Name | Required | Description | Default |
|---|---|---|---|
| collection | Yes | Collection name | |
| id | Yes | Record ID |
Implementation Reference
- src/index.ts:859-876 (handler)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)}` ); } }
- src/index.ts:275-288 (schema)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);