Skip to main content
Glama

Resolve Alias

resolve_alias
Read-onlyIdempotent

Resolve aliases or display names to actual note paths by searching frontmatter aliases and filenames. Translates human-friendly titles into note paths.

Instructions

Find every note whose frontmatter aliases: field contains the given name (case-insensitive). With includeBasename: true, also matches notes whose filename (without .md) equals the name — Obsidian's resolution fallback when no alias matches. Use to translate a human-friendly title like 'My Project' into the actual note path before calling get_note.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesAlias or display name to resolve, e.g. 'My Project'.
includeBasenameNoIf true (default), also match notes whose filename (without extension) equals `name`.

Implementation Reference

  • The async handler function that executes the resolve_alias tool logic: reads all notes, checks frontmatter aliases and optionally basenames, returns matching note paths.
    async ({ name, includeBasename }) => {
      try {
        const target = name.trim().toLowerCase();
        if (!target) return errorResult("name must not be empty");
        const notes = await listNotes(vaultPath);
        const { contents } = await readAllCached(vaultPath, notes, (note, err) => {
          log.warn("resolve_alias: note read failed", { note, err });
        });
    
        const aliasMatches: string[] = [];
        const basenameMatches: string[] = [];
        for (const notePath of notes) {
          if (includeBasename) {
            const basename = path.basename(notePath, path.extname(notePath)).toLowerCase();
            if (basename === target) basenameMatches.push(notePath);
          }
          const content = contents.get(notePath);
          if (content === undefined) continue;
          const aliases = extractAliases(content);
          if (aliases.some((a) => a.toLowerCase() === target)) aliasMatches.push(notePath);
        }
    
        const total = aliasMatches.length + basenameMatches.length;
        if (total === 0) {
          return { content: [{ type: "text" as const, text: `No alias or basename match for "${name}"` }] };
        }
    
        const lines: string[] = [`Matches for "${name}":`, ""];
        if (aliasMatches.length > 0) {
          lines.push(`Alias matches (${aliasMatches.length}):`);
          for (const p of aliasMatches) lines.push(`  - ${p}`);
        }
        if (basenameMatches.length > 0) {
          if (aliasMatches.length > 0) lines.push("");
          lines.push(`Basename matches (${basenameMatches.length}):`);
          for (const p of basenameMatches) lines.push(`  - ${p}`);
        }
        return { content: [{ type: "text" as const, text: lines.join("\n") }] };
      } catch (err) {
        log.error("resolve_alias failed", { tool: "resolve_alias", err: err as Error });
        return errorResult(`Error resolving alias: ${sanitizeError(err)}`);
      }
    },
  • Input schema for resolve_alias: requires a string `name` (min 1 char) and optional boolean `includeBasename` (default true).
    inputSchema: {
      name: z
        .string()
        .min(1)
        .describe("Alias or display name to resolve, e.g. 'My Project'."),
      includeBasename: z
        .boolean()
        .optional()
        .default(true)
        .describe("If true (default), also match notes whose filename (without extension) equals `name`."),
    },
  • Registration of the 'resolve_alias' tool on the MCP server via server.registerTool() within registerReadTools.
    server.registerTool(
      "resolve_alias",
      {
        title: "Resolve Alias",
        description:
          "Find every note whose frontmatter `aliases:` field contains the given name (case-insensitive). With `includeBasename: true`, also matches notes whose filename (without `.md`) equals the name — Obsidian's resolution fallback when no alias matches. Use to translate a human-friendly title like 'My Project' into the actual note path before calling get_note.",
        annotations: {
          readOnlyHint: true,
          idempotentHint: true,
          openWorldHint: false,
        },
        inputSchema: {
          name: z
            .string()
            .min(1)
            .describe("Alias or display name to resolve, e.g. 'My Project'."),
          includeBasename: z
            .boolean()
            .optional()
            .default(true)
            .describe("If true (default), also match notes whose filename (without extension) equals `name`."),
        },
      },
      async ({ name, includeBasename }) => {
        try {
          const target = name.trim().toLowerCase();
          if (!target) return errorResult("name must not be empty");
          const notes = await listNotes(vaultPath);
          const { contents } = await readAllCached(vaultPath, notes, (note, err) => {
            log.warn("resolve_alias: note read failed", { note, err });
          });
    
          const aliasMatches: string[] = [];
          const basenameMatches: string[] = [];
          for (const notePath of notes) {
            if (includeBasename) {
              const basename = path.basename(notePath, path.extname(notePath)).toLowerCase();
              if (basename === target) basenameMatches.push(notePath);
            }
            const content = contents.get(notePath);
            if (content === undefined) continue;
            const aliases = extractAliases(content);
            if (aliases.some((a) => a.toLowerCase() === target)) aliasMatches.push(notePath);
          }
    
          const total = aliasMatches.length + basenameMatches.length;
          if (total === 0) {
            return { content: [{ type: "text" as const, text: `No alias or basename match for "${name}"` }] };
          }
    
          const lines: string[] = [`Matches for "${name}":`, ""];
          if (aliasMatches.length > 0) {
            lines.push(`Alias matches (${aliasMatches.length}):`);
            for (const p of aliasMatches) lines.push(`  - ${p}`);
          }
          if (basenameMatches.length > 0) {
            if (aliasMatches.length > 0) lines.push("");
            lines.push(`Basename matches (${basenameMatches.length}):`);
            for (const p of basenameMatches) lines.push(`  - ${p}`);
          }
          return { content: [{ type: "text" as const, text: lines.join("\n") }] };
        } catch (err) {
          log.error("resolve_alias failed", { tool: "resolve_alias", err: err as Error });
          return errorResult(`Error resolving alias: ${sanitizeError(err)}`);
        }
      },
    );
  • src/index.ts:308-308 (registration)
    Call to registerReadTools which registers resolve_alias along with other read tools on the MCP server.
    registerReadTools(server, vaultForTools);
  • The extractAliases helper function that parses frontmatter to extract aliases from various casing variants (aliases, Aliases, ALIASES, alias, Alias). Returns an array of trimmed alias strings.
    export function extractAliases(content: string): string[] {
      const { data } = parseFrontmatter(content);
      const aliasField =
        data.aliases ?? data.Aliases ?? data.ALIASES ?? data.alias ?? data.Alias;
      if (!aliasField) return [];
    
      if (Array.isArray(aliasField)) {
        return aliasField.map((a: unknown) => String(a).trim()).filter(Boolean);
      }
    
      if (typeof aliasField === "string") {
        return aliasField.split(",").map((a: string) => a.trim()).filter(Boolean);
      }
    
      return [];
    }
Behavior4/5

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

Annotations declare readOnly and idempotent. Description adds case-insensitivity and basename fallback behavior, which are not in annotations. No contradictions.

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?

Two sentences, concise and well-structured. First sentence states primary function, second adds option and usage context. No unnecessary words.

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?

Covers matching logic, case-insensitivity, and basename option. Mention of 'translate into actual note path' implies return value but lacks explicit output schema explanation. Still sufficiently complete for a simple query tool.

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

Parameters4/5

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

Schema coverage is 100%, baseline 3. Description adds case-insensitivity for name and explains includeBasename as a fallback, adding meaning beyond the schema.

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 finds notes with matching aliases in frontmatter, and optionally matches basename. Differentiates from siblings by specifying it resolves aliases to note paths before using get_note.

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 'Use to translate a human-friendly title ... before calling get_note', providing a clear use case. Explains includeBasename as Obsidian's fallback. Does not explicitly mention when not to use, but context is sufficient.

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/rps321321/obsidian-mcp-pro'

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