open_nodes
Retrieve detailed information about specific entities and their relationships within the Elasticsearch Knowledge Graph, enabling structured querying and analysis for AI models.
Instructions
Get details about specific entities in knowledge graph (memory) and their relations
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| memory_zone | Yes | Optional memory zone to retrieve entities from. If not specified, uses the default zone. | |
| names | Yes | Names of entities to retrieve |
Implementation Reference
- src/index.ts:997-1031 (handler)Handler implementation for the 'open_nodes' tool. Fetches specified entities and their inter-relations from the knowledge graph (using kgClient), formats the data, and returns it via formatResponse.else if (toolName === "open_nodes") { const names = params.names || []; const zone = params.memory_zone; // Get the entities const entities: ESEntity[] = []; for (const name of names) { const entity = await kgClient.getEntity(name, zone); if (entity) { entities.push(entity); } } // Format entities const formattedEntities = entities.map(e => ({ name: e.name, entityType: e.entityType, observations: e.observations })); // Get relations between these entities const entityNames = formattedEntities.map(e => e.name); const { relations } = await kgClient.getRelationsForEntities(entityNames, zone); // Map relations to the expected format const formattedRelations = relations.map(r => ({ from: r.from, to: r.to, type: r.relationType, fromZone: r.fromZone, toZone: r.toZone })); return formatResponse({ entities: formattedEntities, relations: formattedRelations }); }
- src/index.ts:372-392 (schema)JSON schema definition for the 'open_nodes' tool input, specifying properties 'names' (required array of strings) and 'memory_zone' (required string), returned in ListTools response for tool registration.{ name: "open_nodes", description: "Get details about specific entities in knowledge graph (memory) and their relations", inputSchema: { type: "object", properties: { names: { type: "array", items: {type: "string"}, description: "Names of entities to retrieve" }, memory_zone: { type: "string", description: "Optional memory zone to retrieve entities from. If not specified, uses the default zone." } }, required: ["names", "memory_zone"], additionalProperties: false, "$schema": "http://json-schema.org/draft-07/schema#" } },
- src/index.ts:649-651 (registration)Registration of all tools including 'open_nodes' via the ListToolsRequestHandler, which returns the tool list containing the schema for open_nodes.}); // Register the call tool handler to handle tool executions