Skip to main content
Glama

Infer a reusable JSON Schema from a sample

infer_schema

Given one sample document's text, propose a reusable JSON Schema for that document type. Use this when no built-in schema_id fits: infer a schema once, review it, then reuse it as schema on parse_document / parse_text across many documents for consistent output. Returns the JSON Schema plus a flat field list and an inferred doc_type. Costs 1 credit per successful call.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesA single representative sample of the document type, as text.
doc_typeNoOptional hint for what kind of document this is, e.g. "purchase order", "lab report".
instructionsNoOptional guidance on which fields matter or how to shape the schema.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior4/5

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

Annotations are all false, providing no safety profile, so the description carries the burden. It discloses the return structure ('JSON Schema plus a flat field list and an inferred doc_type'), the cost ('1 credit per successful call'), and the non-idempotent nature by implying a one-time inference followed by review. It does not explicitly discuss error conditions or side effects, but for a non-destructive inference tool, this is adequate. No contradiction with annotations.

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?

The description is three sentences with no fluff. The first sentence states the core function, the second provides usage guidance and workflow, and the third summarizes returns and cost. It is front-loaded with the purpose and each sentence earns its place. The structure is clear and scannable.

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?

The tool is moderately complex, but the description covers all essential aspects: the input (sample text), the output (schema, field list, doc_type), the workflow (infer, review, reuse), the cost, and the relationship to sibling tools. No output schema exists, so describing the return is the responsibility of the description, which it does. An agent has everything needed to call it correctly.

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 coverage is 100%: all three parameters have descriptions in the input schema. The description adds marginal value by referring to the `text` parameter as the sample, reinforcing its role, but does not elaborate on `doc_type` or `instructions` beyond what the schema already provides. With full schema coverage, a baseline of 3 is appropriate; the description does not detract.

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?

The description states a specific verb ('infer'), resource ('reusable JSON Schema'), and source ('a sample document's text'). It explicitly contrasts with the alternative of using a built-in schema_id, distinguishing it from parse_document and parse_text, which consume schemas rather than create them. The purpose is unambiguous and clearly differentiated from siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

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

The description gives an explicit when-to-use: 'Use this when no built-in schema_id fits', and then prescribes a workflow: infer once, review it, reuse as schema on parse_document/parse_text. It also mentions the cost implication, which is a practical constraint. No alternative is left unspecified, and the guidance is actionable.

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.