open_nodes
Retrieve specific entities from a knowledge graph by providing their names to access stored information across chat sessions.
Instructions
Open specific nodes in the knowledge graph by their names
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| names | Yes | An array of entity names to retrieve |
Implementation Reference
- index.ts:698-717 (handler)The core handler function in KnowledgeGraphManager that loads the full graph, filters entities by the provided names, filters relations to only those connecting the selected 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:1082-1094 (schema)JSON schema defining the input for the open_nodes tool: an object with a required 'names' array of strings.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:1242-1243 (registration)Registration and dispatch logic in the MCP server's CallToolRequest handler that maps the tool call to the knowledgeGraphManager.openNodes method.case "open_nodes": return { content: [{ type: "text", text: JSON.stringify(await knowledgeGraphManager.openNodes(args.names as string[]), null, 2) }] };