UpdateRecord
Modify existing records in RushDB by updating specific fields without replacing entire entries, using partial data updates for targeted changes.
Instructions
Update an existing record (partial update)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| recordId | Yes | ID of the record to update | |
| label | Yes | Label for the record | |
| data | Yes | The updated (partial) record data | |
| transactionId | No | Optional transaction ID for atomic update |
Implementation Reference
- tools/UpdateRecord.ts:17-31 (handler)The main handler function for the UpdateRecord tool. It updates a record in the database using the provided recordId, label, and data, optionally within a transaction, and returns a success message.
export async function UpdateRecord(params: { recordId: string label: string data: Record<string, any> transactionId?: string }) { const { recordId, label, data, transactionId } = params await db.records.update({ target: recordId, label, data }, transactionId) return { success: true, message: `Record updated successfully` } } - tools.ts:89-102 (schema)The JSON schema definition and metadata for the UpdateRecord tool, used for input validation and tool listing in MCP.
{ name: 'UpdateRecord', description: 'Update an existing record (partial update)', inputSchema: { type: 'object', properties: { recordId: { type: 'string', description: 'ID of the record to update' }, label: { type: 'string', description: 'Label for the record' }, data: { type: 'object', description: 'The updated (partial) record data' }, transactionId: { type: 'string', description: 'Optional transaction ID for atomic update' } }, required: ['recordId', 'label', 'data'] } }, - index.ts:152-166 (registration)The dispatch case in the CallToolRequest handler that registers and invokes the UpdateRecord tool handler during MCP tool calls.
case 'UpdateRecord': const updateResult = await UpdateRecord({ recordId: args.recordId as string, label: args.label as string, data: args.data as Record<string, any>, transactionId: args.transactionId as string | undefined }) return { content: [ { type: 'text', text: updateResult.message } ] } - index.ts:28-28 (registration)Import statement that brings the UpdateRecord handler into the main index for use in tool dispatching.
import { UpdateRecord } from './tools/UpdateRecord.js'