open_nodes
Retrieve specific entities from a knowledge graph by name to access stored information across conversations, enabling persistent memory for AI interactions.
Instructions
Open specific nodes in the knowledge graph by their names
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| names | Yes | An array of entity names to retrieve |
Implementation Reference
- index.ts:183-203 (handler)The core handler function in KnowledgeGraphManager that loads the graph, filters entities by the provided names, includes only relations between those entities, and returns the filtered subgraph.
async openNodes(names: string[]): Promise<KnowledgeGraph> { const graph = await this.loadGraph(); // Filter entities const filteredEntities = graph.entities.filter(e => names.includes(e.name)); // Create a Set of filtered entity names for quick lookup const filteredEntityNames = new Set(filteredEntities.map(e => e.name)); // Filter relations to only include those between filtered entities const filteredRelations = graph.relations.filter(r => filteredEntityNames.has(r.from) && filteredEntityNames.has(r.to) ); const filteredGraph: KnowledgeGraph = { entities: filteredEntities, relations: filteredRelations, }; return filteredGraph; } - index.ts:439-453 (schema)The tool schema definition including name, description, and input schema specifying an array of entity names.
{ name: "open_nodes", description: "Open specific nodes in the knowledge graph by their names", inputSchema: { type: "object", properties: { names: { type: "array", items: { type: "string" }, description: "An array of entity names to retrieve", }, }, required: ["names"], }, }, - index.ts:533-534 (registration)The switch case in the CallToolRequestSchema handler that dispatches the call to knowledgeGraphManager.openNodes.
case "open_nodes": return { content: [{ type: "text", text: JSON.stringify(await knowledgeGraphManager.openNodes(args.names as string[]), null, 2) }] };