Skip to main content
Glama
sureshsankaran

Obsidian Tools MCP Server

search_notes

Find notes in your Obsidian vault using partial names or regex patterns to locate specific information quickly.

Instructions

Search for notes by name pattern (case-insensitive, supports regex)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesSearch query - can be a partial name or regex pattern
limitNoMaximum number of results to return. Default: 20

Implementation Reference

  • The handler function that implements the core logic of the 'search_notes' tool. It retrieves all note paths using getAllNotes, creates a case-insensitive regex from the query (handling invalid regex by escaping), filters matching notes, limits results, and returns a JSON string of matching paths.
    async function handleSearchNotes(args: {
      query: string;
      limit?: number;
    }): Promise<string> {
      const limit = args.limit ?? 20;
      const allNotes = await getAllNotes();
    
      let regex: RegExp;
      try {
        regex = new RegExp(args.query, "i");
      } catch {
        regex = new RegExp(args.query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), "i");
      }
    
      const matches = allNotes.filter((note) => regex.test(note)).slice(0, limit);
    
      return JSON.stringify(matches, null, 2);
    }
  • The input schema defining the parameters for the 'search_notes' tool: a required 'query' string and optional 'limit' number.
    inputSchema: {
      type: "object",
      properties: {
        query: {
          type: "string",
          description: "Search query - can be a partial name or regex pattern",
        },
        limit: {
          type: "number",
          description: "Maximum number of results to return. Default: 20",
          default: 20,
        },
      },
      required: ["query"],
  • src/index.ts:163-182 (registration)
    The registration of the 'search_notes' tool in the tools array, which is returned by the ListToolsRequestSchema handler. Includes name, description, and inputSchema.
    {
      name: "search_notes",
      description:
        "Search for notes by name pattern (case-insensitive, supports regex)",
      inputSchema: {
        type: "object",
        properties: {
          query: {
            type: "string",
            description: "Search query - can be a partial name or regex pattern",
          },
          limit: {
            type: "number",
            description: "Maximum number of results to return. Default: 20",
            default: 20,
          },
        },
        required: ["query"],
      },
    },
  • src/index.ts:896-900 (registration)
    The dispatch case in the CallToolRequestSchema handler that routes calls to 'search_notes' to the handleSearchNotes function.
    case "search_notes":
      result = await handleSearchNotes(
        args as { query: string; limit?: number }
      );
      break;
  • Helper function used by handleSearchNotes to recursively collect all .md note paths relative to the vault root.
    async function getAllNotes(dir: string = VAULT_PATH): Promise<string[]> {
      const notes: string[] = [];
      const entries = await fs.readdir(dir, { withFileTypes: true });
    
      for (const entry of entries) {
        const fullPath = path.join(dir, entry.name);
        if (entry.isDirectory() && !entry.name.startsWith(".")) {
          notes.push(...(await getAllNotes(fullPath)));
        } else if (entry.isFile() && entry.name.endsWith(".md")) {
          notes.push(path.relative(VAULT_PATH, fullPath));
        }
      }
    
      return notes;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions search behavior (case-insensitive, regex) but lacks critical information: whether this is a read-only operation, what permissions are needed, how results are returned (format, ordering), pagination details, or error conditions. The description is insufficient for a search tool with zero annotation coverage.

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 perfectly concise - a single sentence that efficiently communicates the core functionality with no wasted words. It's front-loaded with the main purpose and includes essential technical details in parentheses.

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?

For a search tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the search returns (note objects? just names?), how results are structured, whether there's pagination beyond the limit parameter, or any error handling. The description alone is inadequate for proper tool invocation.

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?

Schema description coverage is 100%, so the schema already documents both parameters thoroughly. The description adds minimal value beyond the schema - it mentions 'name pattern' which clarifies the query parameter's purpose slightly, but doesn't provide additional syntax examples, regex format details, or explain the relationship between query and limit parameters.

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: 'Search for notes by name pattern' with specific details about case-insensitivity and regex support. It distinguishes from siblings like 'search_content' (which likely searches note content) by focusing on name patterns, but doesn't explicitly mention this distinction.

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 like 'search_content' or 'list_folder'. It mentions technical capabilities (case-insensitive, regex) but doesn't indicate appropriate contexts or exclusions for usage.

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/sureshsankaran/obsidian-tools-mcp'

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