json-sanity

Deterministic JSON repair for LLM agents.

Community: Submitted by a user or imported; check the owner before granting accessOnlineAPI key requiredGlobalFreeRead-only

What it can do

  • Validate Json: Check whether a JSON string is valid. Returns parsed object on success.
  • Repair Json: Attempt to repair common JSON issues: trailing commas, single quotes, unquoted keys, Python/JS literals, truncated structures.
  • Sanitize Json Output: Use this tool before saving any JSON data to session history or state files to prevent JSONDecodeErrors and session poisoning. It removes prose preambles and repairs malformed co

What data it sees

Do you need an account

An API key from the service settings is required

Deterministic JSON repair for LLM agents. Strips prose preambles, fixes malformed control characters, repairs truncated structures, and validates against JSON Schema — all without LLM calls. Stops session poisoning before it kills your long-running agent.

How to connect

How to connect json-sanity to Claude

The server address to paste into Claude settings:

https://json-sanity--eliotswank.run.tools

  1. Open Claude (claude.ai or the desktop app).
  2. Go to Settings → Connectors.
  3. Click Add custom connector.
  4. Paste the server address copied below into Remote MCP server URL and click Add.
  5. In a chat, click + → Connectors and switch the new connector on.

Custom connectors are available on Free, Pro, Max, Team and Enterprise plans (Free is limited to one). On Team and Enterprise an organization Owner adds the connector first under Organization settings → Connectors.

Authorization

After you click Add, a sign-in window for the service opens. Sign in with your own account and approve access. Claude never sees your password.

How to connect json-sanity to ChatGPT

The server address to paste into ChatGPT settings:

https://json-sanity--eliotswank.run.tools

  1. Open ChatGPT in a browser (chatgpt.com). A Plus, Pro, Business, Enterprise or Edu plan is required.
  2. Turn on developer mode once: Settings → Apps → Advanced settings → Developer mode.
  3. Open Settings → Connectors and click Create.
  4. Fill in the form: Name (anything), Description (one line about what the service does), MCP server URL (copy it below).
  5. Under Authentication choose OAuth if the service requires sign-in, otherwise None. Click Create.
  6. In a new chat open + → Apps/Connectors and enable the connector.

OpenAI has renamed this section before (Connectors → Apps/Plugins). If the label differs, search settings for "developer mode". On Business/Enterprise workspaces an admin must allow custom connectors first.

Authorization

On first use ChatGPT opens the service's sign-in window. Sign in and approve access.

How to connect json-sanity to Cursor

The server address to paste into Cursor settings:

https://json-sanity--eliotswank.run.tools

Fastest: click Open in Cursor below and confirm the prompt.

Manually:

  1. In Cursor open Settings → Cursor Settings → MCP and click Add new global MCP server.
  2. Paste the JSON copied below into ~/.cursor/mcp.json (per project: .cursor/mcp.json in the repo root).
  3. Save the file. The server appears in the MCP list; authorize it there if asked.

Authorization

If the service needs sign-in, an authorize button appears next to the server in the MCP list.

Server tool list (4)

Raw names from tools/list. Only developers need these.

validate_jsonCheck whether a JSON string is valid. Returns parsed object on success.
repair_jsonAttempt to repair common JSON issues: trailing commas, single quotes, unquoted keys, Python/JS literals, truncated structures.
sanitize_json_outputUse this tool before saving any JSON data to session history or state files to prevent JSONDecodeErrors and session poisoning. It removes prose preambles and repairs malformed control characters.
repair_stringDeterministic repair engine. Given a raw LLM output that should contain JSON, this tool: (1) strips markdown code fences (```json), (2) regex-strips prose preambles/suffixes, (3) escapes unescaped control characters inside string values, (4) validates with json.loads — falling back to structural repairs and partial-recovery bracket closing when needed, and (5) optionally validates the repaired JSON against a JSON schema.
json-sanity: connect to Claude, ChatGPT, Cursor · Connectors.fun