FindOneRecord
Locate a specific record in RushDB's graph database using search criteria and label filters to retrieve matching data.
Instructions
Find a single record that matches the given search criteria
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| labels | No | Filter by record labels | |
| where | No | Search conditions for finding the record |
Implementation Reference
- tools/FindOneRecord.ts:17-26 (handler)The core handler function implementing the tool logic: queries the database for a single record matching optional labels and where conditions, returns the record data or null.export async function FindOneRecord(params: { labels?: string[]; where?: Record<string, any> }) { const { labels, where } = params const result = await db.records.findOne({ ...(labels && { labels }), ...(where && { where }) }) return result?.data || null }
- tools.ts:338-345 (schema)Input schema definition for validating tool parameters: optional labels array and where object.inputSchema: { type: 'object', properties: { labels: { type: 'array', items: { type: 'string' }, description: 'Filter by record labels' }, where: { type: 'object', description: 'Search conditions for finding the record' } }, required: [] }
- tools.ts:335-346 (registration)Registers the FindOneRecord tool in the exported tools array used by MCP listTools endpoint, including metadata and schema.{ name: 'FindOneRecord', description: 'Find a single record that matches the given search criteria', inputSchema: { type: 'object', properties: { labels: { type: 'array', items: { type: 'string' }, description: 'Filter by record labels' }, where: { type: 'object', description: 'Search conditions for finding the record' } }, required: [] } },
- index.ts:368-380 (registration)Registers the tool call dispatcher in the MCP CallToolRequestSchema handler: invokes FindOneRecord and returns formatted response.case 'FindOneRecord': const foundOneRecord = await FindOneRecord({ labels: args.labels as string[] | undefined, where: args.where as Record<string, any> | undefined }) return { content: [ { type: 'text', text: foundOneRecord ? JSON.stringify(foundOneRecord, null, 2) : 'No matching record found.' } ] }