Skip to main content
Glama
BRO3886

Memory Custom

by BRO3886

search_nodes

Find nodes in a knowledge graph by matching queries against entity names, types, and observation content within specified memory files.

Instructions

Search for nodes in the knowledge graph based on a query

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe search query to match against entity names, types, and observation content
memoryFilePathYesThe path to the memory file

Implementation Reference

  • The core handler function that implements the logic for searching nodes in the knowledge graph by filtering entities based on query matches in name, entityType, or observations, and including only relations between matched entities.
    async searchNodes(query: string, filepath: string): Promise<KnowledgeGraph> {
      await this.setMemoryFilePath(filepath);
      const graph = await this.loadGraph();
    
      // Filter entities
      const filteredEntities = graph.entities.filter(
        (e) =>
          e.name.toLowerCase().includes(query.toLowerCase()) ||
          e.entityType.toLowerCase().includes(query.toLowerCase()) ||
          e.observations.some((o) =>
            o.toLowerCase().includes(query.toLowerCase())
          )
      );
    
      // 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 defining the parameters for the search_nodes tool: query (string) and memoryFilePath (string).
    inputSchema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description:
            "The search query to match against entity names, types, and observation content",
        },
        memoryFilePath: {
          type: "string",
          description: "The path to the memory file",
        },
      },
      required: ["query", "memoryFilePath"],
    },
  • index.ts:540-558 (registration)
    Registration of the search_nodes tool in the list of available tools, including name, description, and input schema.
    {
      name: "search_nodes",
      description: "Search for nodes in the knowledge graph based on a query",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description:
              "The search query to match against entity names, types, and observation content",
          },
          memoryFilePath: {
            type: "string",
            description: "The path to the memory file",
          },
        },
        required: ["query", "memoryFilePath"],
      },
    },
  • index.ts:692-707 (registration)
    Dispatch handler in the CallToolRequestSchema switch statement that invokes the searchNodes method with provided arguments and returns the result as JSON.
    case "search_nodes":
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              await knowledgeGraphManager.searchNodes(
                args.query as string,
                args.memoryFilePath as string
              ),
              null,
              2
            ),
          },
        ],
      };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool searches based on a query but does not describe key behaviors: whether it returns partial matches, supports pagination, has rate limits, requires authentication, or what the output format is (e.g., list of nodes with details). For a search tool with zero annotation coverage, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded with the core action ('Search for nodes'), making it easy to parse. Every part of the sentence earns its place by specifying the resource and context, though it could benefit from more detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (searching a knowledge graph with 2 required parameters) and the lack of annotations and output schema, the description is incomplete. It does not explain what 'nodes' include, how results are returned, or any behavioral traits like search scope or limitations. For a tool with no structured output information, the description should provide more context to be fully helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, with clear documentation for both parameters ('query' and 'memoryFilePath'). The description adds no additional meaning beyond the schema, such as query syntax examples or memory file path constraints. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description does not compensate but also does not detract.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Search for nodes in the knowledge graph based on a query', which specifies the verb ('search'), resource ('nodes'), and scope ('knowledge graph'). It distinguishes from siblings like 'open_nodes' (likely for opening specific nodes) and 'read_graph' (likely for reading the entire graph), though not explicitly. However, it could be more specific about what 'nodes' encompass (e.g., entities, relations, observations).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention sibling tools like 'open_nodes' (which might retrieve specific nodes) or 'read_graph' (which might fetch the entire graph), nor does it specify prerequisites (e.g., needing a memory file path). Without such context, an agent might struggle to choose between this and other tools for accessing graph data.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/BRO3886/mcp-memory-custom'

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