Skip to main content
Glama

update_note

Modify existing note content in your Obsidian vault by specifying the file path and new text to update your knowledge base.

Instructions

Update an existing note's content

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes
pathYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for 'update_note'. Validates input parameters, calls the vault helper method, and returns success/error messages.
    @mcp.tool(name="update_note", description="Update an existing note's content")
    async def update_note(path: str, content: str) -> str:
        """
        Update an existing note's content (preserves frontmatter).
    
        Args:
            path: Relative path to the note
            content: New content for the note body
    
        Returns:
            Success message
        """
        if not path or not path.strip():
            return "Error: Path cannot be empty"
        if len(path) > 1000:
            return "Error: Path too long"
        if len(content) > 1_000_000:
            return "Error: Content too large (max 1MB)"
    
        context = _get_context()
    
        try:
            await context.vault.update_note(path, content)
            return f"✓ Updated note: {path}"
    
        except FileNotFoundError:
            return f"Error: Note not found: {path}"
        except VaultSecurityError as e:
            return f"Error: Security violation: {e}"
        except Exception as e:
            logger.exception(f"Error updating note {path}")
            return f"Error updating note: {e}"
  • The @mcp.tool decorator registers the update_note function as an MCP tool with the specified name.
    @mcp.tool(name="update_note", description="Update an existing note's content")
  • The core helper method in ObsidianVault class that performs the actual file update, handling path validation, frontmatter preservation or update, and asynchronous file writing.
    async def update_note(
        self, relative_path: str, content: str, frontmatter: dict[str, Any] | None = None
    ) -> None:
        """
        Update an existing note's content.
    
        Args:
            relative_path: Path to the note
            content: New content for the note
            frontmatter: Optional frontmatter dict (replaces existing if provided)
    
        Raises:
            VaultSecurityError: If path is invalid
            FileNotFoundError: If note doesn't exist
        """
        file_path = self._validate_path(relative_path)
    
        if not file_path.exists():
            raise FileNotFoundError(f"Note not found: {relative_path}")
    
        # If frontmatter not provided, preserve existing
        if frontmatter is None:
            note = await self.read_note(relative_path)
            frontmatter = note.frontmatter
    
        # Build full content
        full_content = ""
        if frontmatter:
            full_content = "---\n"
            full_content += yaml.dump(frontmatter, default_flow_style=False, sort_keys=False)
            full_content += "---\n"
    
        full_content += content
    
        # Write file
        async with aiofiles.open(file_path, "w", encoding="utf-8") as f:
            await f.write(full_content)
        logger.info(f"Updated note: {relative_path}")
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 states the tool updates content, implying a mutation operation, but doesn't cover critical aspects: whether it overwrites or merges content, permissions required, error handling (e.g., if path doesn't exist), or side effects. This is a significant gap for a mutation tool with zero annotation coverage.

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 with zero waste. It's front-loaded with the core action ('Update an existing note's content'), making it easy to parse. Every word contributes directly to the purpose, achieving optimal conciseness for such a brief statement.

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

Completeness3/5

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

Given the tool has an output schema (which handles return values), the description's minimalism is partially acceptable. However, as a mutation tool with no annotations and low parameter semantics, it should do more to explain behavior and usage. The description is complete enough for basic understanding but inadequate for safe, effective use without additional context.

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

Parameters2/5

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

Schema description coverage is 0%, so the schema provides no parameter descriptions. The description mentions 'content' but doesn't explain what 'path' is (e.g., file path, note identifier) or details like format constraints (e.g., markdown, plain text). It adds minimal value beyond the parameter names, failing to compensate for the lack of schema documentation.

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') and resource ('an existing note's content'), making the purpose immediately understandable. It distinguishes from sibling tools like 'create_note' (creates new) and 'append_to_note' (adds to existing), though it doesn't explicitly mention these distinctions. The description is specific but could be more precise about what 'content' encompasses.

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. It doesn't mention prerequisites (e.g., note must exist), exclusions (e.g., cannot update non-existent notes), or comparisons to siblings like 'batch_update_notes' (for multiple notes) or 'update_frontmatter' (for metadata). Usage is implied only by the verb 'Update,' leaving the agent to infer context.

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/getglad/obsidian_mcp'

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