BulkDeleteRecords
Delete multiple database records at once using search conditions, labels, or transaction IDs to remove data matching specific criteria.
Instructions
Delete multiple records matching a query
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| labels | No | Filter by record labels | |
| where | Yes | Search conditions for records to delete | |
| transactionId | No | Optional transaction ID for atomic bulk deletion |
Implementation Reference
- tools/BulkDeleteRecords.ts:27-42 (handler)The core handler function that performs bulk deletion of records matching the provided where clause and optional labels, using the database API.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 tool.type BulkDeleteRecordsArgs = { labels?: string[] where: Record<string, any> transactionId?: string } type BulkDeleteRecordsResult = { message: string }
- tools.ts:270-282 (registration)MCP tool registration entry defining the name, description, and input schema for BulkDeleteRecords in the tools list.{ 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 (handler)The switch case dispatcher in the main server handler that invokes the BulkDeleteRecords function and formats the MCP response.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 } ] }