-
Notifications
You must be signed in to change notification settings - Fork 69
edit-note fails with "Invalid discriminator value" for all operation types #38
Description
Bug: edit-note fails with "Invalid discriminator value" for all operation types
Repository: https://github.com/StevenStavrakis/obsidian-mcp
Tool affected: edit-note
Severity: High — tool is completely non-functional; blocks all in-place note editing
Description
The edit-note tool throws MCP error -32602: Invalid arguments: Invalid discriminator value for every operation type (replace, append, prepend). Since all three valid operation values produce this error, the tool is entirely unusable. The error message itself is contradictory — it reports that valid values like replace are invalid, even though replace is explicitly listed in the expected set.
Steps to Reproduce
Call edit-note with any valid operation value:
json{
"vault": "my-vault",
"filename": "test-note.md",
"folder": "some-folder",
"operation": "replace",
"content": "Updated content here"
}
Also tested with:
json{ "operation": "append", "content": "appended text" }
{ "operation": "prepend", "content": "prepended text" }
All three produce the same error.
Actual Behavior
MCP error -32602: MCP error -32602: Invalid arguments: Invalid discriminator value.
Expected 'delete' | 'append' | 'prepend' | 'replace'
This error is returned regardless of which operation value is passed — including values that are explicitly listed as expected by the error message itself (e.g., replace).
Expected Behavior
edit-note with operation: "replace" should replace the full note content.
edit-note with operation: "append" should append content to the end of the note.
edit-note with operation: "prepend" should prepend content to the beginning of the note.
Environment
Client: Claude Desktop (Cowork mode)
OS: Windows 11
Vault location: OneDrive (C:\Users...\OneDrive\Documents\Obsidian Data...)
Other tools tested (working): create-note, read-note, delete-note, search-vault — all function correctly
Workaround
Delete the target note with delete-note (moves to Obsidian trash, not permanent), then recreate it with create-note containing the updated full content. This is destructive and loses any Obsidian link backlinks to the original file, but functionally achieves a replace operation.
Additional Notes
The tool's parameter schema in the MCP manifest is defined as {"properties": {}, "type": "object"} — an empty schema. It's possible the server-side discriminated union validation is not correctly receiving or parsing the operation field when called through the MCP protocol, causing it to treat the value as undefined/null even when explicitly provided. Might be worth checking whether the zod/schema validation on the server side is correctly mapped to the incoming JSON body structure.
Reported via Claude Desktop · 2026-03-10