Skip to main content
Glama

IA-QA — 152 QA & Dev Tools for AI Agents

flatten_json

Read-onlyIdempotent

Flatten a nested JSON object to single-level dot-notation keys (e.g. {"a":{"b":1}} → {"a.b":1}), or unflatten dot-notation keys back to a nested object. Supports custom separators.

Input Schema

NameRequiredDescriptionDefault
modeNo"flatten" (default) or "unflatten"
inputYesThe JSON to flatten or unflatten — a JSON string, or the object itself.
separatorNoKey separator (default: ".")

Output Schema

NameRequiredDescriptionDefault
resultNo
key_countNo
max_depthNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "input": {
      +      "a": {
      +        "b": 1,
      +        "c": [
      +          1,
      +          2
      +        ]
      +      }
      +    }
      +  }
      +]
  2. Changed2 schema fields changed
    • changedInput schema / properties / input / description
      Previous value: -"JSON string to flatten or unflatten"New value: +"The JSON to flatten or unflatten — a JSON string, or the object itself."
    • changedInput schema / properties / input / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "object",
      +  "array"
      +]
  3. Changed1 schema field changed
    • addedOutput schema / properties
      Added value: +{
      +  "key_count": {
      +    "type": "number"
      +  },
      +  "max_depth": {
      +    "type": "array"
      +  },
      +  "result": {}
      +}
  4. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
  5. First observed

TDQS

A4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, and non-destructive, so the safety profile is covered. The description adds the transformation semantics (dot-notation, custom separators), but is silent on edge cases beyond the schema example: whether array indices become keys, how key collisions are resolved, or what happens on invalid JSON input.

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?

Two sentences, zero waste: the core transformation and example come first, with unflatten and custom separators trailing as qualifications. No boilerplate or repetition of schema text.

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?

With an output schema present and 100% parameter coverage, the description need not explain return values, and it correctly covers both modes. The only shortfall is unstated behavior for arrays/collisions and error handling, which matters for a JSON transform that receives arbitrary shapes.

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 mode, input, and separator are already fully documented in the schema, including defaults. The description only restates the separator support and implies the mode switch, adding no syntax or edge-case meaning beyond the structured fields. Baseline 3 applies.

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?

States a specific verb (flatten/unflatten) and resource (nested JSON object) with an inline example transformation, and covers both directions in one definition. An agent can immediately tell this apart from format_json, extract_json_path, or json_to_csv without opening any schema.

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?

Gives clear conditions for each direction: nested input → dot-notation keys, dot-notation input → nested object. It does not name an alternative sibling (e.g., when to prefer format_json for pretty-printing), so there are no explicit exclusions, but the mode selection context is unambiguous.

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.