Skip to main content
Glama
bezata

kObsidian MCP

Analyze Note Tags

tags.analyze
Read-onlyIdempotent

Analyze a single note to extract and categorize its tags into frontmatter, inline, and deduplicated union lists.

Instructions

Return the tags present in a single note, split into frontmatterTags, inlineTags, and their de-duplicated union allTags. Use this when you have one note and want to know what tags it carries — contrast with tags.search, which scans the whole vault for one specific tag. Read-only.

Operates on the session-active vault (see vault.current — selectable via vault.select) unless an explicit vaultPath argument is passed, which always wins.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesVault-relative note path to analyze.
vaultPathNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
frontmatterTagsYes
inlineTagsYes
allTagsYesUnion of frontmatter and inline tags, de-duplicated.

Implementation Reference

  • The handler registration for the 'tags.analyze' tool. It parses args using tagsAnalyzeArgsSchema, reads the note via readNote(), and extracts tags via extractAllTags().
    {
      name: "tags.analyze",
      title: "Analyze Note Tags",
      description:
        "Return the tags present in a single note, split into `frontmatterTags`, `inlineTags`, and their de-duplicated union `allTags`. Use this when you have one note and want to know what tags it carries — contrast with `tags.search`, which scans the whole vault for one specific tag. Read-only.",
      inputSchema: tagsAnalyzeArgsSchema,
      outputSchema: tagsAnalyzeOutputSchema,
      annotations: READ_ONLY,
      handler: async (context, rawArgs) => {
        const args = tagsAnalyzeArgsSchema.parse(rawArgs) as TagsAnalyzeArgs;
        const note = await readNote(context, { path: args.path, vaultPath: args.vaultPath });
        return { path: note.path, ...extractAllTags(note.content) };
      },
    },
  • Input schema (tagsAnalyzeArgsSchema) defining the 'path' and optional 'vaultPath' arguments accepted by tags.analyze.
    export const tagsAnalyzeArgsSchema = z
      .object({
        path: notePathSchema.describe("Vault-relative note path to analyze."),
        vaultPath: z.string().optional(),
      })
      .strict()
      .describe("Arguments for `tags.analyze`.");
    export type TagsAnalyzeArgs = z.input<typeof tagsAnalyzeArgsSchema>;
  • Output schema (tagsAnalyzeOutputSchema) defining the shape returned by tags.analyze: path, frontmatterTags, inlineTags, and allTags.
    export const tagsAnalyzeOutputSchema = z
      .object({
        path: z.string(),
        frontmatterTags: z.array(z.string()),
        inlineTags: z.array(z.string()),
        allTags: z.array(z.string()).describe("Union of frontmatter and inline tags, de-duplicated."),
      })
      .passthrough();
  • The tags.analyze tool is registered as part of the tagTools array (line 61-101 contains the full tags.search, tags.analyze, and tags.list registrations).
      },
      {
        name: "tags.search",
        title: "Search Notes By Tag",
        description:
          "Find every note in the vault that contains a given tag, either in frontmatter `tags` or as an inline `#tag` in the body. Leading `#` on the query is stripped. For each hit, the result carries `{file, absolutePath, tagLocations: {frontmatter, inline}}` so callers can distinguish where the tag came from. Read-only. For analyzing tags of ONE specific note (not a vault-wide search), use `tags.analyze` instead.",
        inputSchema: tagsSearchArgsSchema,
        outputSchema: tagsSearchOutputSchema,
        annotations: READ_ONLY,
        handler: async (context, rawArgs) => {
          const args = tagsSearchArgsSchema.parse(rawArgs) as TagsSearchArgs;
          return searchByTag(context, args);
        },
      },
      {
        name: "tags.analyze",
        title: "Analyze Note Tags",
        description:
          "Return the tags present in a single note, split into `frontmatterTags`, `inlineTags`, and their de-duplicated union `allTags`. Use this when you have one note and want to know what tags it carries — contrast with `tags.search`, which scans the whole vault for one specific tag. Read-only.",
        inputSchema: tagsAnalyzeArgsSchema,
        outputSchema: tagsAnalyzeOutputSchema,
        annotations: READ_ONLY,
        handler: async (context, rawArgs) => {
          const args = tagsAnalyzeArgsSchema.parse(rawArgs) as TagsAnalyzeArgs;
          const note = await readNote(context, { path: args.path, vaultPath: args.vaultPath });
          return { path: note.path, ...extractAllTags(note.content) };
        },
      },
      {
        name: "tags.list",
        title: "List All Tags",
        description:
          "List every unique tag used across the vault (frontmatter and inline combined). With `includeCounts: true`, each item includes how many notes carry the tag; `sortBy` lets you sort by `name` or `count` (the latter requires counts). Read-only. For finding notes carrying a specific tag, use `tags.search`.",
        inputSchema: tagsListArgsSchema,
        outputSchema: tagsListOutputSchema,
        annotations: READ_ONLY,
        handler: async (context, rawArgs) => {
          const args = tagsListArgsSchema.parse(rawArgs) as TagsListArgs;
          return listTags(context, args);
        },
      },
    ];
  • The extractAllTags() helper function that parses frontmatter and the note body to separate frontmatterTags, inlineTags, and their union allTags.
    export function extractAllTags(content: string) {
      const parsed = parseFrontmatter(content);
      const frontmatterTags = getFrontmatterTags(parsed.data);
      const inlineTags = Array.from(content.matchAll(TAG_PATTERN), (match) => match[1]).filter(
        (tag): tag is string => typeof tag === "string" && tag.length > 0,
      );
      const allTags = Array.from(new Set([...frontmatterTags, ...inlineTags]));
      return { frontmatterTags, inlineTags, allTags };
    }
Behavior3/5

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

Annotations already cover read-only, destructive, idempotent hints. Description adds context about splitting tags and vault selection behavior, but doesn't mention edge cases like missing note or no tags. Adds moderate value beyond annotations.

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?

Three sentences, front-loaded with main purpose, no unnecessary words. Each sentence serves a distinct function: result, usage guidance, context.

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

Completeness4/5

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

Given output schema exists, return values need not be described. Description covers primary usage, vault selection, and sibling distinction. Missing edge cases (e.g., no tags, non-existent path) but overall complete for typical use.

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 describes 'path' param well, but 'vaultPath' has no schema description. Description compensates by explaining vaultPath overrides default vault, adding meaning. Baseline for 50% schema coverage is low, so description provides partial improvement.

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

Purpose5/5

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

Clearly states the tool returns tags from a single note split into three categories. Distinguishes from sibling tags.search by specifying it's for one note vs scanning whole vault.

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

Usage Guidelines4/5

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

Explicitly says when to use (for one note's tags) and contrasts with tags.search. Also mentions vault selection context. However, doesn't explicitly state when not to use or list alternatives other than the sibling.

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/bezata/kObsidian'

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