Skip to main content
Glama

FindRelationships

Discover and analyze connections between data entities in your database using search conditions, sorting, and pagination to understand data relationships.

Instructions

Find relationships in the database

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of relationships to return
orderByNoSorting configuration: key = field, value = asc|desc
skipNoNumber of relationships to skip
whereNoSearch conditions for finding relationships

Implementation Reference

  • The main handler function that executes the tool logic: destructures params, builds search query, calls db.relationships.find, and returns results.
    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 [] }
  • Defines the tool's name, description, and input schema for validation (where, limit, skip, orderBy).
    { 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 and invokes the FindRelationships tool in the MCP server's CallToolRequest handler switch statement.
    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' } ] }

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