Skip to main content
Glama

ai_structured

Read-only

ai_structured — Structured extraction with YOUR schema: turn any text into a JSON object that matches a JSON Schema (or shorthand like name:string,amount:number,due:date,tags:string[],status:open|closed). Unknown values come back null (no guessing); output is validated offline (types, enum, required, min/max, lengths, items, date/email formats), numeric/boolean strings are coerced, and the model gets one automatic retry with the errors. text= and schema= required (text up to 12000 chars, 60 properties). Price: $0.008 USDC (Base, via x402).

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": {
      "text": "<text>",
      "schema": "<schema>"
    },
    "name": "ai_structured"
  }
}

Input Schema

NameRequiredDescriptionDefault
textYesInvoice 4471 from Acme Corp, total $1,250.00 due 2026-12-15. Contact billing@acme.com.
schemaYesinvoice_number:string,vendor:string,total:number,due:date,email:email,paid:boolean

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.1/5.0
Behavior5/5

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

Beyond the annotations (readOnlyHint/openWorldHint/destructiveHint=false), the description discloses the actual runtime behavior: unknown values return null rather than being guessed, output is validated offline across types/enum/required/min-max/lengths/items/date-email formats, string coercion happens, and one automatic retry occurs with errors fed back. It also discloses hard limits (12,000 chars, 60 properties) and the x402 payment cost, none of which the annotations carry.

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 one dense, front-loaded sentence with no filler, and the required-parameter and price facts are placed at the end where they are easy to scan. The heavy parenthetical nesting (validation list, shorthand grammar) makes it slightly harder to parse than it needs to be.

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

Completeness5/5

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

With no output schema, the description still explains what comes back (a validated JSON object, nulls for unknown fields, coercion rules, a retry on validation failure) plus input limits and pricing. Nothing an agent needs in order to call this correctly and anticipate the response is missing.

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%, so the baseline is 3, but the description adds genuine meaning the schema does not: the compact shorthand grammar for schema= (name:string,amount:number,due:date,tags:string[],status:open|closed) and the size ceiling on text and schema (12,000 chars, 60 properties). The schema's own descriptions are only runnable examples, so the format documentation here is the real specification.

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 names a specific verb and resource — 'turn any text into a JSON object that matches a JSON Schema' — and the 'YOUR schema' framing implicitly separates it from fixed-shape extraction siblings like ai_extract. It never names an alternative outright, so an agent must still infer which sibling to prefer.

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 rather than stated: an agent can infer this is the tool for schema-typed extraction, and the description says text= and schema= are required. There is no explicit when-to-use/when-not guidance or routing to a sibling tool.

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