Skip to main content
Glama
HenriqueCSouzza

Obsidian MCP Local

find_by_tag

Search for notes in your Obsidian vault by tag. Retrieves all notes containing the specified tag, enabling quick discovery and organization of tagged content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
tagYes

Implementation Reference

  • Core logic: walks all markdown files in the vault, checks frontmatter tags and inline #tags, returns matching file paths with match locations.
    export async function findByTag(tag: string) {
      const normalizedTag = tag.replace(/^#/, "").trim().toLowerCase();
    
      if (!normalizedTag) return [];
    
      const files = await walkMarkdownFiles(VAULT_ROOT);
      const results: Array<{ path: string; matchedIn: string[] }> = [];
    
      for (const fullPath of files) {
        const raw = await fs.readFile(fullPath, "utf-8");
        const parsed = matter(raw);
        const relativePath = toRelativeVaultPath(fullPath);
    
        const matchedIn: string[] = [];
    
        const fmTags = parsed.data?.tags;
        if (Array.isArray(fmTags)) {
          const found = fmTags.some(
            (t) => String(t).replace(/^#/, "").toLowerCase() === normalizedTag,
          );
          if (found) matchedIn.push("frontmatter.tags");
        }
    
        const inlineTagRegex = /(^|\s)#([a-zA-Z0-9/_-]+)/g;
        for (const match of parsed.content.matchAll(inlineTagRegex)) {
          const foundTag = match[2]?.toLowerCase();
          if (foundTag === normalizedTag) {
            matchedIn.push("content");
            break;
          }
        }
    
        if (matchedIn.length > 0) {
          results.push({ path: relativePath, matchedIn });
        }
      }
    
      return results.sort((a, b) => a.path.localeCompare(b.path));
    }
  • Input schema: requires a non-empty string 'tag' validated by Zod.
    { inputSchema: { tag: z.string().min(1) } },
  • Registers the tool 'find_by_tag' on the MCP server with handler calling findByTag helper.
    export function register(server: McpServer): void {
      server.registerTool(
        "find_by_tag",
        { inputSchema: { tag: z.string().min(1) } },
        async ({ tag }) => {
          const results = await findByTag(tag);
          return {
            content: [{ type: "text", text: JSON.stringify(results, null, 2) }],
          };
        },
      );
    }
  • src/server.ts:18-18 (registration)
    Registers findByTag tool in the main server setup.
    findByTag.register(server);
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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/HenriqueCSouzza/obsidian-mcp-local'

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