SetRecord
Replace all fields of a database record with new values using a record ID, label, and data object. This tool updates existing records in RushDB's graph database.
Instructions
Replace all fields of a record with provided values
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| recordId | Yes | ID of the record to set | |
| label | Yes | Label for the record | |
| data | Yes | The new record data to set | |
| transactionId | No | Optional transaction ID for atomic set |
Implementation Reference
- tools/SetRecord.ts:17-31 (handler)The core handler function that executes the SetRecord tool logic: sets the record data using db.records.set and returns a success message.export async function SetRecord(params: { recordId: string label: string data: Record<string, any> transactionId?: string }) { const { recordId, label, data, transactionId } = params await db.records.set({ target: recordId, label, data }, transactionId) return { success: true, message: `Record '${recordId}' set successfully with label '${label}'` } }
- tools.ts:321-334 (schema)Defines the tool schema including name, description, and inputSchema for validation in the MCP server.{ name: 'SetRecord', description: 'Replace all fields of a record with provided values', inputSchema: { type: 'object', properties: { recordId: { type: 'string', description: 'ID of the record to set' }, label: { type: 'string', description: 'Label for the record' }, data: { type: 'object', description: 'The new record data to set' }, transactionId: { type: 'string', description: 'Optional transaction ID for atomic set' } }, required: ['recordId', 'label', 'data'] } },
- index.ts:352-366 (registration)Registers the tool handler in the MCP server's CallToolRequestSchema switch statement, dispatching arguments to the SetRecord function and formatting the response.case 'SetRecord': const setResult = await SetRecord({ 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: setResult.message } ] }
- index.ts:40-40 (registration)Imports the SetRecord handler function for use in the MCP server.import { SetRecord } from './tools/SetRecord.js'