# json-sanity

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 se…

## Quick Start

```bash
# Connect this server (installs CLI if needed)
npx -y @smithery/cli@latest mcp add eliotswank/json-sanity

# Browse available tools
npx -y @smithery/cli@latest tool list eliotswank/json-sanity

# Get full schema for a tool
npx -y @smithery/cli@latest tool get eliotswank/json-sanity validate_json

# Call a tool
npx -y @smithery/cli@latest tool call eliotswank/json-sanity validate_json '{}'
```

## Direct MCP Connection

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

**Required config:**
- `api_key_id` (query) — Your Stripe Customer ID (starts with cus_). Get one at https://json-sanity.netlify.app

## Tools (4)

- `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 stru…
- `sanitize_json_output` — Use this tool before saving any JSON data to session history or state files to prevent JSONDecodeErrors and session poi…
- `repair_string` — Deterministic repair engine. Given a raw LLM output that should contain JSON, this tool: (1) strips markdown code fence…

```bash
# Get full input/output schema for a tool
npx -y @smithery/cli@latest tool get eliotswank/json-sanity <tool-name>
```
