Skip to main content
Glama

open_nodes

Retrieve specific entities by name from the Memento MCP knowledge graph memory, enabling efficient access to structured, semantically rich data for advanced analysis and decision-making.

Instructions

Open specific nodes in your Memento MCP knowledge graph memory by their names

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namesYesAn array of entity names to retrieve

Implementation Reference

  • The handler logic for the 'open_nodes' MCP tool. It calls KnowledgeGraphManager.openNodes with the provided names and returns the resulting KnowledgeGraph as JSON text.
    case 'open_nodes': return { content: [ { type: 'text', text: JSON.stringify(await knowledgeGraphManager.openNodes(args.names), null, 2), }, ], };
  • Registration of the 'open_nodes' tool in the listToolsHandler, including its name, description, and input schema.
    { name: 'open_nodes', description: 'Open specific nodes in your Memento MCP knowledge graph memory by their names', inputSchema: { type: 'object', properties: { names: { type: 'array', items: { type: 'string' }, description: 'An array of entity names to retrieve', }, }, required: ['names'], }, },
  • Core implementation of openNodes in KnowledgeGraphManager, which delegates to storage provider or filters the loaded graph.
    async openNodes(names: string[]): Promise<KnowledgeGraph> { if (this.storageProvider) { return this.storageProvider.openNodes(names); } // Fallback to file-based implementation const graph = await this.loadGraph(); // Filter entities by name const filteredEntities = graph.entities.filter((e) => names.includes(e.name)); // Get relations connected to these entities const filteredRelations = graph.relations.filter( (r) => names.includes(r.from) || names.includes(r.to) ); return { entities: filteredEntities, relations: filteredRelations, }; }
  • Concrete implementation of openNodes in the FileStorageProvider, filtering entities and subgraph relations by given names.
    async openNodes(names: string[]): Promise<KnowledgeGraph> { // Handle empty input array case if (names.length === 0) { return { entities: [], relations: [] }; } // Load the entire graph const graph = await this.loadGraph(); // Create a Set of names for faster lookups const nameSet = new Set(names); // Filter entities by name const filteredEntities = graph.entities.filter((entity) => nameSet.has(entity.name)); // Create a Set of entity names that were found const foundEntityNames = new Set(filteredEntities.map((entity) => entity.name)); // Filter relations to only include those between found entities const filteredRelations = graph.relations.filter( (relation) => foundEntityNames.has(relation.from) && foundEntityNames.has(relation.to) ); return { entities: filteredEntities, relations: filteredRelations, }; }

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/gannonh/memento-mcp'

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