Automatic repair invalid JSON formatted MCP messages generated by LLM
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
Start by locating the MCP message parsing path and the interface before plaintext is parsed into JSON; the issue names no files or tests. Review the proposed json_repair and try_parse approaches, then clarify whether the goal is framework-integrated repair or an extension point, with acceptance criteria for malformed values and trailing commas.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
MCP request is transported in JSON format, which is generated by LLM. However, for LLMs that are not clever enough, the strings it generated are not always valid JSON. For example, LLM may generate [1, 2, 3, 4,], or { "page_index": "0" } while "page_index" requires an integer.
Describe the solution you'd like
Community has provided solutions such as json_repair, try_parse. I wonder if it is considered right decision to integrate such ability into the MCP framework, or at least exposes an interface for users to do such things.
Describe alternatives you've considered
Provide an interface before parsing plaintext string into JSON structures
- Dominant language
- Rust
- Stars
- 3.9k
- Forks
- 645
- Avg merge
- 4d 13h
- Merged PRs (30d)
- 36
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/rust-sdk
-
streamable-http server: a supplied Mcp-Method contradicting an initialize body is silently accepted Openbug P1 ready for work T-transport
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
modelcontextprotocol/rust-sdk#1271 ·
-
bug P2 ready for work T-model
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelcontextprotocol/rust-sdk#1242 ·
-
P3 question T-documentation T-enhancement
Difficulty 1/5 Under an hour Newbie friendliness 86/100
modelcontextprotocol/rust-sdk#1155 ·
-
bug P1 ready for work T-model T-service
Difficulty 3/5 1-2 days Newbie friendliness 72/100
modelcontextprotocol/rust-sdk#1283 · 1 comment ·
-
bug P0 ready for work T-security T-transport
modelcontextprotocol/rust-sdk#1272 · 1 assignee ·
All issues in modelcontextprotocol/rust-sdk
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
gitbutlerapp/gitbutler#15998 · 1 comment ·
-
bug triage:deciding
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-telemetry/otel-arrow#4132 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100