get_entity_connections
Explore and retrieve entities connected to a specified entity via relationships. Filter connections by category and use pagination to manage large datasets. Ideal for analyzing corporate influence and accountability on the LittleSis MCP server.
Instructions
Get other entities that this entity has relationships with
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category_id | No | Filter connections by relationship category | |
| id | Yes | The entity ID | |
| page | No | Page number for pagination |
Implementation Reference
- src/tools/entity-tools.ts:281-306 (handler)Handler function that executes the get_entity_connections tool logic by calling LittleSisApi.getEntityConnections and formatting the response as MCP content.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 schema definition including input validation for the get_entity_connections tool.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 the tool handler in the main server for handling CallTool requests.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/api.ts:83-91 (helper)API client method that fetches entity connections from LittleSis API, called by the tool 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); }