BulkDeleteRecords
Remove multiple database records that match specific search conditions in RushDB. Use this tool to clean up data by deleting records based on defined criteria and optional labels.
Instructions
Delete multiple records matching a query
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| labels | No | Filter by record labels | |
| transactionId | No | Optional transaction ID for atomic bulk deletion | |
| where | Yes | Search conditions for records to delete |
Implementation Reference
- tools/BulkDeleteRecords.ts:27-42 (handler)The primary handler function implementing the BulkDeleteRecords tool. It constructs a search query from the input arguments and calls the database client's delete method to remove matching records, optionally within a transaction. Returns a success message.export async function BulkDeleteRecords({ labels, where, transactionId }: BulkDeleteRecordsArgs): Promise<BulkDeleteRecordsResult> { const searchQuery: any = { where } if (labels && labels.length > 0) { searchQuery.labels = labels } const result = await db.records.delete(searchQuery, transactionId) return { message: result.data?.message || 'Records deleted successfully' } }
- tools/BulkDeleteRecords.ts:17-25 (schema)TypeScript type definitions for the input arguments and output result of the BulkDeleteRecords handler, providing structure validation.type BulkDeleteRecordsArgs = { labels?: string[] where: Record<string, any> transactionId?: string } type BulkDeleteRecordsResult = { message: string }
- tools.ts:270-282 (registration)MCP tool registration entry in the tools list, including name, description, and JSON input schema for validation by the MCP server.{ name: 'BulkDeleteRecords', description: 'Delete multiple records matching a query', inputSchema: { type: 'object', properties: { labels: { type: 'array', items: { type: 'string' }, description: 'Filter by record labels' }, where: { type: 'object', description: 'Search conditions for records to delete' }, transactionId: { type: 'string', description: 'Optional transaction ID for atomic bulk deletion' } }, required: ['where'] } },
- index.ts:288-301 (helper)Dispatch logic in the MCP CallToolRequest handler that invokes the BulkDeleteRecords tool function with parsed arguments and formats the response for MCP protocol.case 'BulkDeleteRecords': const bulkDeleteResult = await BulkDeleteRecords({ labels: args.labels as string[] | undefined, where: args.where as Record<string, any>, transactionId: args.transactionId as string | undefined }) return { content: [ { type: 'text', text: bulkDeleteResult.message } ] }