SetRecord
Replace all fields of a record with new values in RushDB's graph database, using the record ID, label, and data to perform atomic updates.
Instructions
Replace all fields of a record with provided values
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | The new record data to set | |
| label | Yes | Label for the record | |
| recordId | Yes | ID of the record to set | |
| transactionId | No | Optional transaction ID for atomic set |
Implementation Reference
- tools/SetRecord.ts:17-31 (handler)The core handler function that implements the SetRecord tool by setting the record data in the database using db.records.set.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 input schema, description, and registration entry for the SetRecord tool within the central tools array.{ 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:72-76 (registration)Registers the tools list (including SetRecord schema) for MCP's ListTools request handler.server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools } })
- index.ts:352-366 (handler)The switch-case dispatcher in the MCP CallToolRequest handler that invokes the SetRecord function.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 } ] }