Skip to main content
Glama

open_nodes

Extract specific entities from a knowledge graph by providing their names, enabling targeted retrieval for LLM memory operations on the MCP Memory Server.

Instructions

Open specific nodes in the knowledge graph by their names

Input Schema

NameRequiredDescriptionDefault
namesYesAn 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

  • The openNodes method in the KnowledgeGraphManager class implements the core logic for the 'open_nodes' tool. It loads the full graph, filters entities by the provided names, includes only relations between those entities, and returns the resulting 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; }
  • Input schema definition for the 'open_nodes' tool, specifying that it takes an object with a required 'names' property that is an array of strings.
    inputSchema: { type: "object", properties: { names: { type: "array", items: { type: "string" }, description: "An array of entity names to retrieve", }, }, required: ["names"], },
  • src/index.ts:357-371 (registration)
    Registration of the 'open_nodes' tool in the ListToolsRequestSchema response. Includes the tool 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"], }, },
  • Dispatch handler in the CallToolRequestSchema that invokes the openNodes method with the provided arguments and formats the response as JSON.
    case "open_nodes": return { content: [{ type: "text", text: JSON.stringify(await knowledgeGraphManager.openNodes(args.names as string[]), null, 2) }] };

Other Tools

Related Tools

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/StevenWangler/mcp-memory-server'

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