Skip to main content
Glama
jagoff

obsidian-mcp-complete

by jagoff

obsidian_apply_template

Apply an Obsidian template to a target note, replacing placeholders like date, title, and custom variables. Specify template and target paths with optional variable overrides.

Instructions

Render a template note into a target note. Replaces {{date}}, {{title}}, {{vault}}, and custom variables.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
vaultNoOptional configured vault name. Defaults to the server default vault.
templatePathYesVault-relative path. Absolute paths and traversal are rejected.
targetPathYes
variablesNo
overwriteNo

Implementation Reference

  • The handler implementation for obsidian_apply_template tool. It reads a template note, resolves variables ({{date}}, {{title}}, {{vault}}, and custom variables), renders the template by replacing {{...}} placeholders, and writes the result to the target path.
    tool(
      "obsidian_apply_template",
      "Render a template note into a target note. Replaces {{date}}, {{title}}, {{vault}}, and custom variables.",
      {
        vault: vaultArg,
        templatePath: pathArg,
        targetPath: pathArg,
        variables: z.record(z.string()).optional().default({}),
        overwrite: z.boolean().optional().default(false),
      },
      async (args) => {
        const template = await vaults.readText(args.templatePath, args.vault);
        const target = vaults.notePath(args.targetPath);
        const variables: Record<string, string> = {
          date: new Date().toISOString().slice(0, 10),
          title: path.posix.basename(target).replace(/\.md$/i, ""),
          vault: vaults.getVault(args.vault).name,
          ...args.variables,
        };
        const rendered = template.text.replace(/\{\{\s*([A-Za-z0-9_-]+)\s*\}\}/g, (_m, key: string) => variables[key] ?? "");
        return vaults.writeText(target, rendered, args.vault, { overwrite: args.overwrite });
      },
    );
  • The Zod schema for obsidian_apply_template: accepts vault (optional), templatePath, targetPath, variables (record of strings), and overwrite (boolean default false).
    tool(
      "obsidian_apply_template",
      "Render a template note into a target note. Replaces {{date}}, {{title}}, {{vault}}, and custom variables.",
      {
        vault: vaultArg,
        templatePath: pathArg,
        targetPath: pathArg,
        variables: z.record(z.string()).optional().default({}),
        overwrite: z.boolean().optional().default(false),
      },
  • src/tools.ts:1007-1009 (registration)
    Registration of the obsidian_apply_template tool via the local tool() helper function, with name 'obsidian_apply_template' and description 'Render a template note into a target note. Replaces {{date}}, {{title}}, {{vault}}, and custom variables.'
    tool(
      "obsidian_apply_template",
      "Render a template note into a target note. Replaces {{date}}, {{title}}, {{vault}}, and custom variables.",
Behavior3/5

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

Annotations indicate the tool is not read-only, not destructive, not idempotent, and not open-world. The description adds the behavior of replacing template variables but does not disclose side effects like whether it modifies the target file in place or creates a new file, nor does it explain the overwrite parameter's effect.

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

Conciseness4/5

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

Two sentences; the first sets the action, the second lists variables. Could be slightly more structured but remains efficient and front-loaded.

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?

No output schema is provided, and the description omits important context such as what happens if the template is missing, if the target already exists with overwrite off, or the return value. For a tool with 5 parameters and no output documentation, this is incomplete.

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 description adds meaning to the 'variables' parameter by listing placeholders (date, title, vault). However, schema coverage is low (40%), and the description does not explain 'overwrite' or 'targetPath' behavior beyond the schema's reference.

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?

The description clearly states the tool renders a template into a target note, specifying the exact verb and resources. It distinguishes from siblings like obsidian_create_note or obsidian_patch_note by focusing on template substitution.

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?

No guidance is provided on when to use this tool versus alternatives such as obsidian_create_note or obsidian_patch_active. It does not mention prerequisites or scenarios where this tool is inappropriate.

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

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