Skip to main content
Glama

open_nodes

Retrieve specific entities from a knowledge graph by providing their names. Enhances structured thinking and problem-solving within AI workflows.

Instructions

Open specific nodes in the knowledge graph by their names

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
namesYesArray of entity names to retrieve

Implementation Reference

  • The execute function for the 'open_nodes' tool. It retrieves entities from the knowledge graph using graph.getEntities(args.names), computes found and notFound lists, and returns a JSON string with entities, found names, notFound names, and a summary message.
    execute: async (args) => {
      const results = graph.getEntities(args.names);
      const found = results.map(entity => entity.name);
      const notFound = args.names.filter(name => !found.includes(name));
      
      // Return as string
      return JSON.stringify({
        entities: results,
        found,
        notFound: notFound.length > 0 ? notFound : null,
        message: `Found ${found.length} entities. ${notFound.length} entities not found.`
      });
    }
  • The server.addTool call that registers the 'open_nodes' tool within the registerMemoryTools function, including name, description, parameters schema, and inline execute handler.
    server.addTool({
      name: 'open_nodes',
      description: 'Open specific nodes in the knowledge graph by their names',
      parameters: Schemas.OpenNodesSchema,
      execute: async (args) => {
        const results = graph.getEntities(args.names);
        const found = results.map(entity => entity.name);
        const notFound = args.names.filter(name => !found.includes(name));
        
        // Return as string
        return JSON.stringify({
          entities: results,
          found,
          notFound: notFound.length > 0 ? notFound : null,
          message: `Found ${found.length} entities. ${notFound.length} entities not found.`
        });
      }
    });
  • Zod schema for 'open_nodes' tool input parameters: an array of strings representing entity names to retrieve from the knowledge graph.
    export const OpenNodesSchema = z.object({
      names: z.array(z.string().min(1)).describe('Array of entity names to retrieve')
    });
Install Server

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/flight505/mcp-think-tank'

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