delete_record
Remove a specific record from a PocketBase database collection by specifying the collection name and record ID to manage data efficiently.
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 uses the PocketBase SDK to delete the record specified by collection and id, 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)Input schema for the delete_record tool, specifying collection name and record ID as required string parameters.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)Registration of the delete_record tool in the ListTools response, including name, description, and input schema.{ 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)Dispatch registration in the CallToolRequest handler switch statement, routing calls to the deleteRecord method.case 'delete_record': return await this.deleteRecord(request.params.arguments);