{
  "name": "json.repair",
  "group": "data",
  "summary": "Repair malformed JSON and pinpoint the exact line and column when it cannot be repaired.",
  "description": "Takes JSON that almost parses and makes it parse: markdown code fences, prose wrapped around the object, trailing commas, single or smart quotes, unquoted keys, Python True/False/None, comments, NaN, and brackets left open by a truncated response. Every change is reported, so the caller learns what its generator got wrong rather than silently depending on a fixer. When the input cannot be salvaged it returns the precise line, column and a caret pointing at the offending character — which is what makes the next attempt succeed instead of guessing.",
  "keywords": [
    "fix json",
    "malformed json",
    "broken json",
    "json parse error",
    "invalid json",
    "trailing comma",
    "json syntax error",
    "unterminated string",
    "truncated json",
    "llm json output",
    "repair",
    "unparseable"
  ],
  "endpoint": "https://fluentedi.com/v1/json/repair",
  "mcp_name": "json_repair",
  "makes_network_request": false,
  "parameters": {
    "type": "object",
    "properties": {
      "input": {
        "description": "The malformed JSON text.",
        "type": "string",
        "maxLength": 1000000
      },
      "close_truncated": {
        "description": "Close brackets left open by a cut-off response.",
        "type": "boolean",
        "default": true
      }
    },
    "required": [
      "input"
    ],
    "additionalProperties": false
  },
  "examples": [
    {
      "description": "Markdown fence, trailing comma, unquoted key",
      "url": "https://fluentedi.com/v1/json/repair?input=%60%60%60json%0A%7B%20name%3A%20'Ada'%2C%20tags%3A%20%5B1%2C2%2C%5D%2C%20%7D%0A%60%60%60",
      "args": {
        "input": "```json\n{ name: 'Ada', tags: [1,2,], }\n```"
      }
    },
    {
      "description": "A truncated response",
      "url": "https://fluentedi.com/v1/json/repair?input=%7B%22items%22%3A%5B%7B%22id%22%3A1%7D%2C%7B%22id%22%3A2",
      "args": {
        "input": "{\"items\":[{\"id\":1},{\"id\":2"
      }
    },
    {
      "description": "Python literals in JSON",
      "url": "https://fluentedi.com/v1/json/repair?input=%7B'ok'%3A%20True%2C%20'value'%3A%20None%7D",
      "args": {
        "input": "{'ok': True, 'value': None}"
      }
    }
  ],
  "suggestion": null
}