Skip to main content
Glama

get_entity_relationships

Retrieve all relationships for a specific entity to analyze corporate connections and influence networks, with options to filter by category and sort by date or amount.

Instructions

Get all relationships this entity has with other entities

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesThe entity ID
category_idNoFilter relationships by category (1-12)
sortNoSort order for relationshipsrecent
pageNoPage number for pagination

Implementation Reference

  • The handler function that executes the get_entity_relationships tool logic, calling the LittleSis API and returning formatted results or errors.
    export async function handleGetEntityRelationships(args: any) { try { const result = await LittleSisApi.getEntityRelationships(args.id, { category_id: args.category_id, sort: args.sort, page: args.page }); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching entity relationships: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
  • The Tool object definition including input schema and description for get_entity_relationships.
    export const getEntityRelationshipsTool: Tool = { name: 'get_entity_relationships', description: 'Get all relationships this entity has with other entities', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'The entity ID' }, category_id: { type: 'number', description: 'Filter relationships by category (1-12)' }, sort: { type: 'string', enum: ['amount', 'oldest', 'recent'], description: 'Sort order for relationships', default: 'recent' }, page: { type: 'number', description: 'Page number for pagination', minimum: 1 } }, required: ['id'] } };
  • src/index.ts:72-81 (registration)
    Registration of the get_entity_relationships handler in the toolHandlers mapping used by the MCP server.
    const toolHandlers = { get_entity: handleGetEntity, get_entities: handleGetEntities, search_entities: handleSearchEntities, get_entity_extensions: handleGetEntityExtensions, get_entity_relationships: handleGetEntityRelationships, get_entity_connections: handleGetEntityConnections, get_entity_lists: handleGetEntityLists, get_relationship: handleGetRelationship, };
  • The LittleSisApi helper method that performs the actual API request for entity relationships.
    static async getEntityRelationships(id: number, params?: EntityRelationshipsParams): Promise<LittleSisApiResponse<Relationship[]>> { const searchParams = new URLSearchParams(); if (params?.category_id) searchParams.append('category_id', params.category_id.toString()); if (params?.sort) searchParams.append('sort', params.sort); if (params?.page) searchParams.append('page', params.page.toString()); const paramString = searchParams.toString(); const endpoint = `/entities/${id}/relationships${paramString ? '?' + paramString : ''}`; return makeApiRequest<Relationship[]>(endpoint); }

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/code-rabi/littlesis-mcp'

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