Skip to main content
Glama

prepend_to_note

Add content to the beginning of an Obsidian note while preserving frontmatter structure.

Instructions

Prepend content to a note, after frontmatter if present

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesRelative path to the note
contentYesContent to prepend

Implementation Reference

  • The implementation of prependToNote which inserts content at the beginning of a markdown file, optionally after existing YAML frontmatter.
    export async function prependToNote(
      vaultPath: string,
      relativePath: string,
      content: string,
    ): Promise<void> {
      const fullPath = resolveVaultPath(vaultPath, relativePath);
      const existing = await fs.readFile(fullPath, "utf-8");
    
      // Detect frontmatter block (starts with --- on first line)
      const frontmatterMatch = existing.match(/^---\r?\n[\s\S]*?\r?\n---\r?\n?/);
    
      let result: string;
      if (frontmatterMatch) {
        const frontmatter = frontmatterMatch[0];
        const rest = existing.slice(frontmatter.length);
        const separator = frontmatter.endsWith("\n") ? "" : "\n";
        result = frontmatter + separator + content + "\n" + rest;
      } else {
        result = content + "\n" + existing;
      }
    
      await fs.writeFile(fullPath, result, "utf-8");
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the 'after frontmatter if present' behavior, which is useful context beyond basic functionality. However, it doesn't address critical aspects like whether this is a destructive operation, what permissions are needed, how errors are handled, or what the tool returns. For a mutation tool with zero annotation coverage, this leaves significant gaps.

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 extremely concise - a single sentence that communicates the core functionality and a key behavioral nuance. Every word earns its place, with no redundant information. The structure is front-loaded with the main action.

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?

For a mutation tool with no annotations and no output schema, the description is insufficiently complete. It doesn't explain what happens on success/failure, what the tool returns, whether the operation is atomic, or what side effects might occur. The 'after frontmatter' detail is helpful but doesn't compensate for the missing behavioral context needed for safe tool invocation.

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 description coverage is 100%, so both parameters are already documented in the schema. The description doesn't add any additional meaning about the parameters beyond what's in the schema. It doesn't explain what constitutes a valid 'path' format or provide examples of 'content' formatting. This meets the baseline for high schema coverage.

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 action ('prepend content') and target resource ('to a note'), making the purpose immediately understandable. It distinguishes from 'append_to_note' by specifying prepending rather than appending. However, it doesn't fully differentiate from other note modification tools like 'update_frontmatter' or 'create_note' beyond the prepend action.

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

Usage Guidelines3/5

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

The description provides implicit usage context by mentioning 'after frontmatter if present', which suggests when this tool is appropriate (for notes with frontmatter). However, it doesn't explicitly state when to use this versus alternatives like 'append_to_note' or 'update_frontmatter', nor does it mention prerequisites or exclusions.

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