get_entity_connections
Find relationships between entities in corporate power networks. Retrieve connected entities by ID, filter by relationship type, and paginate results for comprehensive analysis.
Instructions
Get other entities that this entity has relationships with
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The entity ID | |
| category_id | No | Filter connections by relationship category | |
| page | No | Page number for pagination |
Implementation Reference
- src/tools/entity-tools.ts:281-306 (handler)The main handler function that executes the tool logic: validates args, calls LittleSisApi.getEntityConnections, formats JSON response or error.export async function handleGetEntityConnections(args: any) { try { const result = await LittleSisApi.getEntityConnections(args.id, { category_id: args.category_id, page: args.page }); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error fetching entity connections: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
- src/tools/entity-tools.ts:117-139 (schema)Tool object definition containing the input schema for validation and tool discovery.export const getEntityConnectionsTool: Tool = { name: 'get_entity_connections', description: 'Get other entities that this entity has relationships with', inputSchema: { type: 'object', properties: { id: { type: 'number', description: 'The entity ID' }, category_id: { type: 'number', description: 'Filter connections by relationship category' }, page: { type: 'number', description: 'Page number for pagination', minimum: 1 } }, required: ['id'] } };
- src/index.ts:72-81 (registration)Registration of tool handlers in the server, mapping 'get_entity_connections' to its handler function.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, };
- src/index.ts:58-69 (registration)Registration of available tools list including getEntityConnectionsTool for ListToolsRequest.const tools = [ // Entity tools getEntityTool, getEntitesTool, searchEntitesTool, getEntityExtensionsTool, getEntityRelationshipsTool, getEntityConnectionsTool, getEntityListsTool, // Relationship tools getRelationshipTool, ];
- src/api.ts:83-91 (helper)LittleSisApi helper method that makes the HTTP request to fetch entity connections, used by the handler.static async getEntityConnections(id: number, params?: EntityConnectionsParams): Promise<LittleSisApiResponse<Entity[]>> { const searchParams = new URLSearchParams(); if (params?.category_id) searchParams.append('category_id', params.category_id.toString()); if (params?.page) searchParams.append('page', params.page.toString()); const paramString = searchParams.toString(); const endpoint = `/entities/${id}/connections${paramString ? '?' + paramString : ''}`; return makeApiRequest<Entity[]>(endpoint); }