Skip to content

Claude frequently passes a JSON string when setting frontmatter #46

@orf

Description

@orf

I'm not sure why, but Claude seems to frequently pass a string to the frontmatter argument when writing a note, even when instructed very specifically not to. this results in a large array of frontmatter values with each individual character.

⏺ obsidian - write_note (MCP)(path: "sessions/2026/03/05/foo.md", content: "bar", frontmatter: "{\"date\": \"2026-03-05\", \"type\": \"session\",  \"session_id\": \"e3a69763-12b5-41ac-8df0-2bf5b011cdf6\",
    \"tags\": [\"session\", \"feature\", \"error-handling\"]}")
  ⎿  Successfully wrote note: sessions/2026/03/05/foo.md (mode: overwrite)
    2 -'0': '{'
        3 -'1': '"'
        4 -'2': d
        5 -'3': a
        6 -'4': t
        7 -'5': e
        8 -'6': '"'
        9 -'7': ':'
       10 -'8': ' '
       11 -'9': '"'
       12 -'10': '2'
       13 -'11': '0'
       14 -'12': '2'
       15 -'13': '6'
       16 -'14': '-'
       17 -'15': '0'
       18 -'16': '3'
       19 -'17': '-'
       20 -'18': '0'
       21 -'19': '5'
       22 -'20': '"'
       23 -'21': ','
       24 -'22': ' '
       25 -'23': '"'

We could detect if a string is passed in, and attempt to deserialize it as JSON, and use that?

Claude says this:

⏺ I'm not sure what I'm doing differently from the expected format — could you
  clarify what you're seeing? In my tool call the frontmatter parameter value is
  unquoted JSON ({"date":"2026-03-05", ...}) between the XML tags, same as the merge
   parameter is unquoted false. Is there something else I need to change?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions