CreateRecord
Add new records to your RushDB graph database by specifying labels and data fields for structured storage.
Instructions
Create a new record in the database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| label | Yes | Label for the record | |
| data | Yes | The record data to insert | |
| transactionId | No | Optional transaction ID for atomic creation |
Implementation Reference
- tools/CreateRecord.ts:17-31 (handler)The main handler function that executes the CreateRecord tool logic by calling db.records.create to insert a new record.export async function CreateRecord(params: { label: string data: Record<string, any> transactionId?: string }) { const { label, data, transactionId } = params const result = await db.records.create({ label, data }, transactionId) return { success: true, id: result.id(), message: `Record created successfully with label '${label}'` } }
- tools.ts:76-88 (schema)JSON schema definition for the CreateRecord tool input, used for validation in the MCP tool list.{ name: 'CreateRecord', description: 'Create a new record in the database', inputSchema: { type: 'object', properties: { label: { type: 'string', description: 'Label for the record' }, data: { type: 'object', description: 'The record data to insert' }, transactionId: { type: 'string', description: 'Optional transaction ID for atomic creation' } }, required: ['label', 'data'] } },
- index.ts:137-150 (registration)Registration of the CreateRecord handler in the MCP server's CallToolRequestSchema switch dispatcher.case 'CreateRecord': const createResult = await CreateRecord({ label: args.label as string, data: args.data as Record<string, any>, transactionId: args.transactionId as string | undefined }) return { content: [ { type: 'text', text: `${createResult.message}\nID: ${createResult.id}` } ] }