Skip to content

Automatic repair invalid JSON formatted MCP messages generated by LLM #772

@Evian-Zhang

Description

@Evian-Zhang

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions