Skip to main content
Glama

Agent Data Tools: Utilities

JSON schema from example: infer a JSON Schema

json_schema
Read-only

Infer a JSON Schema (draft 2020-12) from an example JSON value: types, nested object properties, required keys, array item shapes merged across all items, and string formats (date-time, date, email, uri, uuid). Use to document an API response or to validate later data against the same shape. Example: json={"id":1,"email":"ada@example.com","tags":["a","b"],"created":"2026-10-23T08:00:00Z"}. Price $0.01/call via x402 USDC or a card key (/credits), first 10 free; failed calls free. Reads or computes only and changes nothing; each call is charged, so repeats are not free.

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": {
      "json": "<json>"
    },
    "name": "json_schema"
  }
}

Input Schema

NameRequiredDescriptionDefault
jsonYesThe example JSON

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.5/5.0
Behavior5/5

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

Adds substantial context beyond the annotations: the pricing model ($0.01/call via x402 USDC or card key, first 10 free), the fact that failed calls are free, and the explicit warning that repeats are not free — which explains and reinforces idempotentHint=false. The "reads or computes only and changes nothing" statement is consistent with readOnlyHint=true and destructiveHint=false and confirms the safety profile in plain language.

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?

Front-loaded with the core purpose and feature list, then usage, then a compact example, then operational details — a sensible ordering. The billing sentence carries three separate facts in one line and is slightly dense, but every clause is materially useful for an agent deciding whether to call.

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 one-parameter, no-output-schema tool, the description covers what is produced (draft 2020-12 schema with the listed inference features), safety, and cost. The only gap is the response envelope itself — whether the schema comes back as a raw string, a formatted document, or wrapped in an object — which an agent cannot infer without an output schema.

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

Parameters4/5

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

Schema coverage is 100% for the single `json` parameter, so the baseline is 3, but the description adds the worked example json={"id":1,"email":"ada@example.com",...}, which clarifies that the value must be a JSON string rather than a pre-parsed object — a real ambiguity the schema text "The example JSON" leaves open. The enumeration of detected formats also hints at how input strings are interpreted.

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 2020-12) from an example JSON value") and enumerates the exact outputs it produces: types, nested properties, required keys, merged array item shapes, and detected string formats. That specificity separates it from neighboring utilities like json_validate or json_format, which operate on already-formed JSON rather than deriving 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 Guidelines4/5

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

Gives concrete use cases — documenting an API response, or validating later data against the same shape — which is clear context for when to reach for it. It stops short of naming alternatives or exclusions (e.g., when to prefer json_validate once a schema exists), so routing is inferred rather than explicit.

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.

Resources