Skip to main content
Glama

FindOneRecord

Locate a specific record in RushDB's graph database by applying search criteria and label filters to retrieve matching data.

Instructions

Find a single record that matches the given search criteria

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelsNoFilter by record labels
whereNoSearch conditions for finding the record

Implementation Reference

  • Core handler function that executes the FindOneRecord tool: queries the database for a single record matching the provided labels and where conditions.
    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:336-346 (registration)
    Tool registration entry in the tools array, providing name, description, and input schema for MCP server.listTools().
      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: []
      }
    },
  • Input schema definition for validating FindOneRecord tool parameters.
      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: []
      }
    },
  • MCP CallToolRequest dispatcher case that invokes the FindOneRecord handler and formats the response content.
    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.'
          }
        ]
      }
  • index.ts:72-76 (registration)
    Registers the listTools capability, returning the tools array which includes FindOneRecord.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools
      }
    })

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/1pxone/RushDB'

If you have feedback or need assistance with the MCP directory API, please join our Discord server