Skip to main content
Glama

sanitize_json_output

Read-onlyIdempotent

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 control characters.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
api_key_idNoYour API key identifier, used to attribute crash-prevention metrics to your account.
raw_stringYesRaw string that should contain JSON, possibly with prose or control character issues.

TDQS

A4/5.0
Behavior4/5

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

Annotations already declare the tool as read-only, idempotent, and non-destructive. The description adds meaningful behavior details: it removes prose preambles and repairs malformed control characters, and explains the consequences it prevents (JSONDecodeErrors, session poisoning). This goes beyond the annotation information.

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

Conciseness5/5

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

The description is two concise sentences, with the first sentence front-loading the usage context and the second describing the behavior. No filler or redundant information.

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?

This is a simple tool with one required parameter and no output schema. The description covers when and what clearly. It does not explicitly state the return value or the role of api_key_id, but these are reasonably inferable from the tool's purpose and schema descriptions, making it slightly incomplete but adequate.

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 coverage is 100%, so the baseline is 3. The description adds no parameter-specific details, but the schema already provides clear descriptions for both raw_string and api_key_id, so no additional burden falls on the description.

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

Purpose4/5

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

The description clearly states the tool's purpose: sanitize JSON output by removing prose and repairing control characters before saving. It differentiates itself from siblings by focusing on the pre-save use case, though it does not explicitly contrast with repair_json or validate_json by name.

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

Usage Guidelines4/5

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

The description explicitly says when to use the tool: 'before saving any JSON data to session history or state files.' It provides a clear context and rationale, but it doesn't mention when not to use it or alternative tools for validation/repair in other scenarios.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

TDQS

A3.8/5.0
Disambiguation2/5

The three repair tools (repair_json, repair_string, sanitize_json_output) have heavily overlapping purposes. While repair_string has a more detailed description, an agent may struggle to choose between it, the generic repair_json, and sanitize_json_output, which also repairs control characters and removes prose. Only validate_json is clearly distinct.

Naming Consistency3/5

The names mix patterns: repair_json and repair_string use the 'repair' verb with different objects, while validate_json and sanitize_json_output use other verbs. The object naming is also inconsistent (json, string, json_output). Overall the set is readable but lacks a uniform convention.

Tool Count4/5

Four tools is a reasonable count for a JSON sanity server, fitting within the typical well-scoped range. However, the inclusion of three overlapping repair functions suggests the count could be trimmed without losing core functionality.

Completeness5/5

The server covers the full lifecycle for its stated purpose: validation (validate_json), repair (repair_json, repair_string), and sanitization (sanitize_json_output). It includes schema validation in repair_string, leaving no obvious gaps in the domain of ensuring JSON sanity.

Resources