open_nodes
Retrieve specific entities by their names from the Knowledge Graph Memory Server, enabling precise access to stored information for enhanced 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 |
Input Schema (JSON Schema)
{
"properties": {
"names": {
"description": "An array of entity names to retrieve",
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"names"
],
"type": "object"
}
Implementation Reference
- index.ts:698-717 (handler)The core handler function for the 'open_nodes' tool. It loads the full knowledge graph, filters entities by the provided names, creates a set for quick lookup, filters relations to only those connecting the selected entities, constructs a filtered subgraph, and returns it as KnowledgeGraph.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:1084-1094 (schema)The input schema definition for the 'open_nodes' tool, specifying an object with a required 'names' array of strings.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)The dispatch/registration in the CallToolRequest handler switch statement that invokes the openNodes handler with args.names and returns the JSON-stringified result.case "open_nodes": return { content: [{ type: "text", text: JSON.stringify(await knowledgeGraphManager.openNodes(args.names as string[]), null, 2) }] };
- index.ts:1081-1095 (registration)The full tool registration object in the ListToolsRequest handler, including name, description, and input schema.{ 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"], }, },