Skip to main content
Glama

open_nodes

Retrieve specific entities from a knowledge graph by their names to access stored information and relationships.

Instructions

Open specific nodes in the knowledge graph by their names

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namesYesAn array of entity names to retrieve
memoryFilePathYesThe path to the memory file

Implementation Reference

  • Core implementation of the 'open_nodes' tool: loads the knowledge graph, filters to include only specified entity names and relations between them, returns the subgraph.
    async openNodes(names: string[], filepath: string): Promise<KnowledgeGraph> { await this.setMemoryFilePath(filepath); 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:559-578 (registration)
    Registers the 'open_nodes' tool in the ListTools response, 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", }, memoryFilePath: { type: "string", description: "The path to the memory file", }, }, required: ["names", "memoryFilePath"], }, },
  • Dispatches CallToolRequest for 'open_nodes' by calling the openNodes method on KnowledgeGraphManager and serializing the result.
    case "open_nodes": return { content: [ { type: "text", text: JSON.stringify( await knowledgeGraphManager.openNodes( args.names as string[], args.memoryFilePath as string ), null, 2 ), }, ], };

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BRO3886/mcp-memory-custom'

If you have feedback or need assistance with the MCP directory API, please join our Discord server