Skip to main content
Glama

Get JSON from ChatGPT

chatgpt_structured
Read-only

Ask ChatGPT or another configured AI to return machine-readable JSON matching a specified shape for field extraction, classification, or test-data generation.

Instructions

Ask ChatGPT (or any AI, via provider) for a machine-readable JSON object (for example, extracting fields from text, classifying items, or generating test data). Describe the shape you want in json_shape.

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": {
      "instruction": "<instruction>",
      "json_shape": "<json_shape>"
    },
    "name": "chatgpt_structured"
  }
}

Input Schema

NameRequiredDescriptionDefault
inputNoOptional source text or data to work on.
modelNoModel ID for the chosen provider, e.g. 'gpt-5.6-sol' or 'gemini-3.8-flash'. You can also write 'provider:model', e.g. 'xai:grok-4.6'. Leave empty to use that provider's default.
providerNoWhich AI to ask: openai (ChatGPT), anthropic (Claude), gemini, xai (Grok), deepseek, mistral, meta (Llama), perplexity, moonshot (Kimi), qwen, cohere, groq, openrouter, ollama or lmstudio. Leave empty for the default. Run ai_list_providers to see which are configured.
json_shapeYesDescribe the JSON object wanted, e.g. '{"name": string, "tags": string[]}'.
instructionYesWhat ChatGPT should produce.
temperatureNoCreativity, 0 to 2. Lower is more focused. Some reasoning models ignore this; the bridge drops it automatically.
reasoning_effortNoFor reasoning models only: how hard the model should think. Higher is slower and more expensive.
max_output_tokensNoUpper limit on the length of ChatGPT's reply, in tokens.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.2.0

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=true, so the outward-calling, non-mutating nature is covered. The description adds that any configured provider can be selected, but says nothing about latency, cost, or what happens when the model fails to honor json_shape.

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?

Two sentences, front-loaded with the core action and examples, then a direct pointer to json_shape. The second sentence slightly overlaps with the schema's own description of json_shape, but the redundancy is small and aids scanning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With eight parameters and no output schema, the definition should say more about the return value — for example whether a parsed JSON object or a raw string comes back, and what happens on malformed output. Annotations cover the safety profile, so the remaining gap is return-shape behavior.

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 eight parameters are already well documented, establishing a baseline of 3. The description only restates json_shape's role and gestures at provider selection, adding no format or behavior detail beyond the schema.

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?

States a specific verb and resource: 'Ask ChatGPT (or any AI, via provider) for a machine-readable JSON object', plus three concrete example use cases. The structured-JSON framing implicitly separates it from freeform siblings like chatgpt_ask and ai_ask, but no sibling is named explicitly.

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 context for when this tool fits (extracting fields, classifying items, generating test data) and points at json_shape as the mechanism. It stops short of exclusions — nothing says to use chatgpt_ask/ai_ask instead when freeform prose is wanted.

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