FindRelationships
Discover and analyze connections between data points in RushDB's graph database to understand complex relationships and dependencies.
Instructions
Find relationships in the database
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| where | No | Search conditions for finding relationships | |
| limit | No | Maximum number of relationships to return | |
| skip | No | Number of relationships to skip | |
| orderBy | No | Sorting configuration: key = field, value = asc|desc |
Implementation Reference
- tools/FindRelationships.ts:17-32 (handler)The core handler function that implements the FindRelationships tool, querying the database for relationships based on provided filters.export async function FindRelationships(params: { where?: Record<string, any> limit?: number skip?: number orderBy?: Record<string, 'asc' | 'desc'> }) { const { where, limit = 10, skip = 0, orderBy } = params const searchQuery: any = { limit, skip } if (where) searchQuery.where = where if (orderBy && Object.keys(orderBy).length > 0) searchQuery.orderBy = orderBy const result = await db.relationships.find(searchQuery) if (result.success && result.data) return result.data return [] }
- tools.ts:239-256 (schema)Defines the input schema, description, and metadata for the FindRelationships tool used in tool listing.{ name: 'FindRelationships', description: 'Find relationships in the database', inputSchema: { type: 'object', properties: { where: { type: 'object', description: 'Search conditions for finding relationships' }, limit: { type: 'number', description: 'Maximum number of relationships to return', default: 10 }, skip: { type: 'number', description: 'Number of relationships to skip', default: 0 }, orderBy: { type: 'object', description: 'Sorting configuration: key = field, value = asc|desc', additionalProperties: { type: 'string', enum: ['asc', 'desc'] } } }, required: [] } },
- index.ts:257-271 (registration)Registers the FindRelationships tool in the MCP server's CallToolRequestSchema handler by dispatching to the handler function.case 'FindRelationships': const relations = await FindRelationships({ where: args.where as Record<string, any> | undefined, limit: args.limit as number | undefined, skip: args.skip as number | undefined, orderBy: args.orderBy as Record<string, 'asc' | 'desc'> | undefined }) return { content: [ { type: 'text', text: relations.length > 0 ? JSON.stringify(relations, null, 2) : 'No relations found' } ] }