modelcontextprotocol / modelcontextprotocol/rust-sdk

Automatic repair invalid JSON formatted MCP messages generated by LLM

Open
#772 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement P3
Dominant language
Rust
Stars
3.9k
Forks
645
Avg merge
4d 13h
Merged PRs (30d)
36

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

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.

Assessment

Tech stack
rust
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.