Skip to main content
Glama

compact_json_and_api

Reduces large JSON, database, or OpenAPI/Swagger payloads to inferred typed schemas with field ranges, enums, and samples, cutting token usage by 75–92%.

Instructions

Deterministically compact huge JSON payloads, DB query dumps, or OpenAPI 3.x/Swagger specs into an inferred typed schema with field cardinality, numeric min/max ranges, enum distributions, and a trimmed sample item (75-92% token reduction).

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": {
      "payload": "<payload>"
    },
    "name": "compact_json_and_api"
  }
}

Input Schema

NameRequiredDescriptionDefault
payloadYesJSON string or JSON object/array (including OpenAPI 3.x / Swagger specs).
maxDepthNoMax object nesting depth to expand (1..6, default: 4).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.5/5.0
Behavior3/5

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

With no annotations provided, the description carries the full burden, and it does disclose meaningful behavior: the operation is deterministic, the output is an inferred typed schema with cardinality, numeric ranges, enum distributions, and a trimmed sample item, plus an expected 75-92% token reduction. It does not state whether the call is read-only, what happens on invalid or non-JSON input, whether there are payload size limits, or how the sample item is selected. Useful context, but incomplete for an unannotated tool.

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?

It is a single dense sentence with the core action and the highest-value detail, the token reduction, front-loaded. Every clause carries information about inputs or outputs, with no filler. The one drawback is that the long clause stack makes it slightly harder to scan than a short multi-sentence structure.

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 tool with no output schema, the description does the important work of explaining what the return value contains: an inferred typed schema, field cardinality, min/max ranges, enum distributions, and a trimmed sample. Combined with 100% schema coverage, an agent has enough to invoke it correctly. Missing are only secondary behavioral details such as error handling and payload limits.

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 'payload' and 'maxDepth' (including its 1..6 range and default of 4) are already documented in the schema. The description adds no further meaning about accepted payload forms or depth trade-offs. Baseline 3 is appropriate when the schema does the heavy lifting.

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 opens with a specific verb and resource: 'Deterministically compact huge JSON payloads, DB query dumps, or OpenAPI 3.x/Swagger specs into an inferred typed schema.' That is far more than a restatement of the name and tells an agent exactly what transformation happens. It stops short of naming a sibling or stating which cases belong to a different tool, so it is clear but not fully differentiated.

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

Usage Guidelines3/5

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

Usage is implied by the input categories ('huge JSON payloads, DB query dumps, or OpenAPI 3.x/Swagger specs') and the token-reduction payoff, which signals when this tool is worth calling. There is no explicit when-not guidance, no prerequisites, and no named alternative such as compress_logs_and_traces or skeletonize_code. An agent can infer the fit but must do the routing itself.

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