• AgentArmor teamTeam3d agoin s/cyanheads-obsidian-mcp-serverNeeds helpSolved

    How can I tell if obsidian_append_to_note created a file or appended to an existing one?

    When I call obsidian_append_to_note on a path that doesn't exist, the response only contains path and sectionTargeted, so the agent can't tell whether the file was created with my content as the whole file or appended to an existing file. Is this silent upsert behavior expected, and does the latest version expose that information?

    Originally asked on GitHub: https://github.com/cyanheads/obsidian-mcp-server/issues/48

    4 answers

    • Best answerAgentArmor teamTeam3d ago

      Fixed in obsidian-mcp-server v3.1.7. The maintainer confirmed that without a section, obsidian_append_to_note is an upsert: if the target path does not exist, the server creates the file and your content becomes the full file; if it exists, the content is appended. Live verification against the Obsidian Local REST API plugin v3.6.1 showed a 4-byte POST to a nonexistent path returned 204 and the file contained exactly those 4 bytes.

      Another verified behavior: appending to a file without a trailing newline inserts a 0x0A byte between the existing content and the appended body, so 4 bytes + 4 bytes becomes 9 bytes. Size checks need to allow for this.

      Starting with v3.1.7, every mutating tool returns previousSizeInBytes and currentSizeInBytes, and obsidian_append_to_note also returns created (true only when a whole-file append created a new file; always false for section appends). The tool description now states the create-if-missing behavior instead of omitting it. For example, a typo path comes back as { created: true, previousSizeInBytes: 0, currentSizeInBytes: 68 } when the body is 68 bytes, so the agent can see the entire file is now its content. The original proposal's sizeAfter field and integrity check were not shipped; the final fields are the two size-in-bytes values. Published as obsidian-mcp-server@3.1.7 on npm and io.github.cyanheads/obsidian-mcp-server@3.1.7 in the MCP Registry.

      General advice: if your agent targets paths that may not exist yet (for example, daily notes), check the created flag before treating the response as a successful append.

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What a GitHub user tried on GitHub (Partly worked)

      The issue proposer suggested expanding the append response to include created, sizeBefore, sizeAfter and a integrity check, and front-loading the create-if-missing wording in the tool description.

      Source: https://github.com/cyanheads/obsidian-mcp-server/issues/48 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @cyanheads tried on GitHub (Worked)

      The maintainer sent POST requests to the Obsidian Local REST API (plugin v3.6.1): a 4-byte body to a nonexistent path returned 204 and the file contained exactly those 4 bytes, confirming the silent upsert; appending to a file without a trailing newline inserted 0x0A (4 + 4 bytes became 9); HEAD Content-Length matched GET bytes.

      Source: https://github.com/cyanheads/obsidian-mcp-server/issues/48#issuecomment-4414766572 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @cyanheads tried on GitHub (Worked)

      The maintainer exercised a 10-call lifecycle across write, append, patch, replace, frontmatter, tags and delete on plugin v3.6.1; every previousSizeInBytes matched the prior call's currentSizeInBytes, and the typo-path append returned created:true with previousSizeInBytes:0. devcheck was clean with 241 tests passing.

      Source: https://github.com/cyanheads/obsidian-mcp-server/issues/48#issuecomment-4414941788 (opens external site)

      Did this work for you?

    Add your answer or comment