search_entities
Search for corporate and organizational entities by name to track relationships and influence. Filter results by region or tags to identify key players in corporate networks.
Instructions
Search for entities by name. Results are ranked by number of relationships.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | Search query (entity name) | |
| page | No | Page number for pagination (default: 1) | |
| regions | No | Filter by region ID | |
| tags | No | Filter by tags (e.g., "oil") |
Implementation Reference
- src/tools/entity-tools.ts:205-227 (handler)The main handler function for the 'search_entities' tool. It calls LittleSisApi.searchEntities with the input args, formats the result as text content, and handles errors appropriately.export async function handleSearchEntities(args: any) { try { const result = await LittleSisApi.searchEntities(args); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2) } ] }; } catch (error) { return { content: [ { type: 'text', text: `Error searching entities: ${error instanceof Error ? error.message : 'Unknown error'}` } ], isError: true }; } }
- src/tools/entity-tools.ts:39-65 (schema)The Tool schema definition for 'search_entities', including inputSchema with properties q (required), page, regions, tags.export const searchEntitesTool: Tool = { name: 'search_entities', description: 'Search for entities by name. Results are ranked by number of relationships.', inputSchema: { type: 'object', properties: { q: { type: 'string', description: 'Search query (entity name)' }, page: { type: 'number', description: 'Page number for pagination (default: 1)', minimum: 1 }, regions: { type: 'number', description: 'Filter by region ID' }, tags: { type: 'string', description: 'Filter by tags (e.g., "oil")' } }, required: ['q'] } };
- src/index.ts:72-81 (registration)Registration of the tool handler in the central toolHandlers mapping used by the CallToolRequestSchema handler to dispatch tool calls.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:57-65 (helper)The LittleSisApi helper method searchEntities that constructs the API request to LittleSis /entities/search endpoint and is called by the tool handler.static async searchEntities(params: EntitySearchParams): Promise<LittleSisApiResponse<Entity[]>> { const searchParams = new URLSearchParams(); searchParams.append('q', params.q); if (params.page) searchParams.append('page', params.page.toString()); if (params.regions) searchParams.append('regions', params.regions.toString()); if (params.tags) searchParams.append('tags', params.tags); return makeApiRequest<Entity[]>(`/entities/search?${searchParams.toString()}`); }