Skip to main content
Glama
YuNaga224

Obsidian Memory MCP

by YuNaga224

search_nodes

Find entities, relations, and observations in your Obsidian knowledge graph using search queries to match names, types, and content.

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

Implementation Reference

  • Core implementation of the search_nodes tool logic: loads the knowledge graph, performs case-insensitive search on entity names, types, and observations, filters matching entities and their inter-relations.
    async searchNodes(query: string): Promise<KnowledgeGraph> {
      const graph = await this.loadGraph();
      const queryLower = query.toLowerCase();
      
      // Filter entities
      const filteredEntities = graph.entities.filter(e => 
        e.name.toLowerCase().includes(queryLower) ||
        e.entityType.toLowerCase().includes(queryLower) ||
        e.observations.some(o => o.toLowerCase().includes(queryLower))
      );
      
      // Get filtered entity names
      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)
      );
      
      return {
        entities: filteredEntities,
        relations: filteredRelations
      };
    }
  • index.ts:173-183 (registration)
    Registers the 'search_nodes' tool with the MCP server, including name, description, and input schema requiring a 'query' parameter.
    {
      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" },
        },
        required: ["query"],
      },
    },
  • Top-level MCP CallTool handler case that delegates to storageManager.searchNodes and formats the response as JSON text content.
    case "search_nodes":
      return { content: [{ type: "text", text: JSON.stringify(await storageManager.searchNodes(args.query as string), null, 2) }] };

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

C2.9/5.0
Behavior2/5

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

With no annotations, the description carries the full burden. It describes the action as 'search' but does not disclose key behaviors such as case sensitivity, partial matching, result limits, ordering, or whether it searches across all entity fields or just specific ones.

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

Conciseness3/5

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

The description is a single sentence with no wasted words, but it is vague and lacks structure. It could be improved by adding brief details or examples without increasing length significantly.

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

Completeness3/5

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

For a simple one-parameter tool without an output schema, the description is minimally adequate. However, given the presence of sibling tools with overlapping functionality, more context (e.g., search scope, result format) would make it complete.

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 schema covers 100% of the parameter with a description that explains what the query matches against. The tool description restates 'based on a query' but adds no additional semantics beyond the schema, so baseline 3 applies.

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 searches for nodes in the knowledge graph based on a query, which is specific enough to distinguish from siblings like 'traverse_graph' or 'query_by_time'. However, it could be more precise (e.g., specifying it's a full-text search).

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 (e.g., 'query_by_time', 'traverse_graph', 'read_graph'). No exclusions or context for selection are given.

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