Skip to main content
Glama
sureshsankaran

Obsidian Tools MCP Server

update_frontmatter

Modify or add YAML frontmatter properties in Obsidian notes to organize metadata, update tags, or remove outdated information.

Instructions

Update or add frontmatter (YAML) properties in a note

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesPath to the note
propertiesYesKey-value pairs to set in frontmatter. Use null to delete a property.

Implementation Reference

  • The handler function that executes the update_frontmatter tool: reads the note, parses frontmatter, updates properties (deleting if null), serializes new frontmatter, appends body, and writes back to file.
    async function handleUpdateFrontmatter(args: {
      path: string;
      properties: Record<string, unknown>;
    }): Promise<string> {
      const fullPath = resolvePath(args.path);
    
      if (!(await fileExists(fullPath))) {
        throw new Error(`Note not found at ${args.path}`);
      }
    
      const content = await fs.readFile(fullPath, "utf-8");
      const { frontmatter, body } = parseFrontmatter(content);
    
      const newFrontmatter = { ...(frontmatter || {}), ...args.properties };
    
      // Remove null values
      for (const [key, value] of Object.entries(newFrontmatter)) {
        if (value === null) {
          delete newFrontmatter[key];
        }
      }
    
      const newContent = serializeFrontmatter(newFrontmatter) + body;
      await fs.writeFile(fullPath, newContent, "utf-8");
    
      return `Successfully updated frontmatter in ${args.path}`;
    }
  • Input schema defining parameters: path (string) and properties (object of key-value pairs, null to delete).
    inputSchema: {
      type: "object",
      properties: {
        path: {
          type: "string",
          description: "Path to the note",
        },
        properties: {
          type: "object",
          description:
            "Key-value pairs to set in frontmatter. Use null to delete a property.",
        },
      },
      required: ["path", "properties"],
    },
  • src/index.ts:300-318 (registration)
    Tool registration in the tools array used for listing available tools.
    {
      name: "update_frontmatter",
      description: "Update or add frontmatter (YAML) properties in a note",
      inputSchema: {
        type: "object",
        properties: {
          path: {
            type: "string",
            description: "Path to the note",
          },
          properties: {
            type: "object",
            description:
              "Key-value pairs to set in frontmatter. Use null to delete a property.",
          },
        },
        required: ["path", "properties"],
      },
    },
  • src/index.ts:930-934 (registration)
    Registration/dispatch in the switch statement for tool calls.
    case "update_frontmatter":
      result = await handleUpdateFrontmatter(
        args as { path: string; properties: Record<string, unknown> }
      );
      break;
  • Helper function to serialize a JavaScript object to YAML frontmatter format, used in the handler.
    function serializeFrontmatter(obj: Record<string, unknown>): string {
      const lines: string[] = [];
      for (const [key, value] of Object.entries(obj)) {
        if (value === null || value === undefined) continue;
        if (Array.isArray(value)) {
          lines.push(`${key}: [${value.join(", ")}]`);
        } else {
          lines.push(`${key}: ${value}`);
        }
      }
      return `---\n${lines.join("\n")}\n---\n`;
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions updating or adding properties but fails to cover critical aspects like whether this operation is destructive, requires specific permissions, handles errors, or affects existing content beyond frontmatter. This leaves significant gaps for a mutation tool.

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 a single, efficient sentence that directly states the tool's function without any fluff or redundancy. It is appropriately sized and front-loaded, making it easy for an agent to parse quickly.

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?

Given the complexity of a mutation tool with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits, error handling, return values, and differentiation from siblings, making it incomplete for safe and effective use by an AI agent.

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 input schema has 100% description coverage, clearly documenting both parameters ('path' and 'properties') with details like using null to delete a property. The description adds no additional semantic meaning beyond what the schema provides, so it meets the baseline for adequate but not enhanced parameter understanding.

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 verb ('update or add') and resource ('frontmatter (YAML) properties in a note'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'update_note', which might also modify notes, leaving room for ambiguity.

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 such as 'update_note' or 'append_to_note'. It lacks context about specific scenarios, prerequisites, or exclusions, leaving the agent to infer usage based on the tool name alone.

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