Skip to main content
Glama

Repair JSON in a local file

repair_json_file
Read-onlyIdempotent

Read and repair broken or incomplete JSON from a local UTF-8 file without changing the source. Use it for files up to 5 MB when you need to fix JSON without pasting text.

Instructions

Read a local JSON file and repair it if it is broken or incomplete.

Use this when the JSON is in a file on this computer, so you don't have to paste it. The file is only read, never changed. Files larger than 5 MB are rejected; use the Apify version for bigger jobs. Do not use it for files that are not JSON text.

path: full path to a UTF-8 text file, up to 5 MB. json_lines: if true, each non-empty line is a separate document. If false (default), the whole text is tried as one JSON value first.

Returns the same object as repair_json_text.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "path": "<path>"
    },
    "name": "repair_json_file"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesFull path to a UTF-8 .json or .jsonl file, up to 5 MB.
json_linesNoIf true, treat each non-empty line as its own JSON document.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint, destructiveHint=false, idempotentHint, and openWorldHint=false, so the description is not obliged to restate the safety profile. It nonetheless adds real operational context: the 5 MB rejection threshold, UTF-8 encoding requirement, and the guarantee that the file is never changed. It omits error behavior for unrepairable input, which keeps it from a 5.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose and the when-to-use rule are front-loaded, then constraints, then parameters, then the return pointer. A few phrases restate the schema ('full path to a UTF-8 text file, up to 5 MB' duplicates the path description verbatim), which is mild waste but does not obscure the guidance.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a two-parameter read-only tool with no output schema, the description covers location, encoding, size ceiling, the large-file alternative, and a cross-reference to the return shape. Only the failure modes and returned repair metadata are unaddressed, a small gap given the tool's simplicity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so both parameters are already documented, and the description's path and json_lines text largely mirrors the schema. The only added meaning is the evaluation ordering implied by 'the whole text is tried as one JSON value first.' Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence names a specific verb and resource ('Read a local JSON file and repair it') and scopes it to broken or incomplete content. It is clearly separated from repair_json_text by the file-vs-pasted-text distinction, and it explicitly says the return value matches repair_json_text, so an agent can place it in the family without opening a schema.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives an explicit when-to-use condition ('when the JSON is in a file on this computer, so you don't have to paste it'), an explicit exclusion ('Do not use it for files that are not JSON text'), and a routing rule for the oversized case ('use the Apify version for bigger jobs'). An agent has no ambiguity about which sibling to pick.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.