Skip to main content
Glama

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

json_schema_generate

Read-onlyIdempotent

Infer a JSON Schema (draft-07) from a sample JSON value. Detects types, required fields, array item shapes, nested objects, and common string formats (email, uri, date, date-time, uuid). Returns a ready-to-use schema compatible with json_schema_validate. Use when you have a sample API response or LLM output and want to auto-generate a validation schema for CI/CD testing.

Input Schema

NameRequiredDescriptionDefault
inputYesThe sample JSON value to infer the schema from — a JSON string, or the value itself.
samplesNoMore samples of the same shape, merged with input: a field seen as null and as a date becomes ["string","null"]; one missing somewhere is not required.
required_allNoMark fields present in every observed object as required (default: true)

Output Schema

NameRequiredDescriptionDefault
schemaNo
warningsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed7 schema fields changed
    • addedInput schema / examples
      Added value: +[
      +  {
      +    "input": {
      +      "a": [
      +        1
      +      ],
      +      "b": true,
      +      "f": 1.5,
      +      "n": 1,
      +      "o": {
      +        "k": null
      +      },
      +      "s": "x"
      +    }
      +  }
      +]
    • changedInput schema / properties / required_all / description
      Previous value: -"Mark all detected object properties as required (default: true)"New value: +"Mark fields present in every observed object as required (default: true)"
    • addedInput schema / properties / samples
      Added value: +{
      +  "description": "More samples of the same shape, merged with input: a field seen as null and as a date becomes [\"string\",\"null\"]; one missing somewhere is not required.",
      +  "type": [
      +    "array",
      +    "string"
      +  ]
      +}
    • removedOutput schema / properties / format
      Removed value: -{}
    • removedOutput schema / properties / items
      Removed value: -{
      -  "type": "object"
      -}
    • removedOutput schema / properties / type
      Removed value: -{
      -  "type": "string"
      -}
    • addedOutput schema / properties / warnings
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
  2. Changed2 schema fields changed
    • changedInput schema / properties / input / description
      Previous value: -"Sample JSON value (object, array, or scalar) to infer the schema from"New value: +"The sample JSON value to infer the schema from — a JSON string, or the value itself."
    • changedInput schema / properties / input / type
      Previous value: -"string"New value: +[
      +  "string",
      +  "object",
      +  "array"
      +]
  3. Changed1 schema field changed
    • addedOutput schema / properties
      Added value: +{
      +  "format": {},
      +  "items": {
      +    "type": "object"
      +  },
      +  "schema": {
      +    "type": "object"
      +  },
      +  "type": {
      +    "type": "string"
      +  }
      +}
  4. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "additionalProperties": true,
      +  "type": "object"
      +}
  5. Added

TDQS

A4/5.0
Behavior3/5

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

Annotations already declare readOnly, idempotent, non-destructive and closed-world, so the safety profile is covered. The description adds real inference behavior (which constructs get detected, the draft-07 target, forward compatibility with the validator), but says nothing about edge cases such as heterogeneous samples, empty input, or how conflicts are resolved.

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?

Three sentences, front-loaded with the core action, then detection scope, then the use case. Every sentence carries distinct information with no restatement of the tool name.

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?

An output schema exists, so return-value explanation is unnecessary, and the description correctly covers behavior, scope and downstream use instead. Only the lack of guidance on degenerate or conflicting inputs keeps it below full marks for a pure-function inference tool.

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 all three parameters, including the subtle null/date merge behavior of 'samples' and the required_all default, are already documented. The description's mention of 'required fields' loosely echoes required_all but adds no syntax or format guidance beyond the schema — 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 and resource — 'Infer a JSON Schema (draft-07) from a sample JSON value' — and names the sibling it complements ('compatible with json_schema_validate'), so an agent can separate it from json_schema_validate and mock_from_schema. The list of inferred features (types, required fields, array shapes, string formats) makes the output concrete.

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 a clear triggering context: 'Use when you have a sample API response or LLM output and want to auto-generate a validation schema for CI/CD testing.' It links forward to json_schema_validate, but never states when not to use it or contrasts it with mock_from_schema, which also consumes schemas.

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.