Trexmi
Generator Ready

MCP Tool Schema Generator

Generate a minimal MCP tool definition and Draft 2020-12 inputSchema from a tool name, description, and representative JSON arguments.

Generate name, description, and inputSchema Infer nested JSON property types Create required-property lists Reject undeclared arguments with additionalProperties false
Generation is deterministic and local to Trexmi. Validate and edit the inferred schema before registering it with an MCP server.
INPUT Sample input JSON
0 chars0 words0 lines

Tool settings

Ctrl / ⌘ + Enter
MCP tool schema Minimal MCP tool definition with a Draft 2020-12 inputSchema.
About the tool

What MCP Tool Schema Generator does

MCP Tool Schema Generator creates a compact Model Context Protocol tool definition from a name, description, and sample JSON arguments. The output contains the core name, description, and inputSchema fields used when an MCP server exposes a callable tool.

The sample is converted deterministically into JSON Schema Draft 2020-12. Object keys become properties, observed values determine initial types, every observed property is marked required, and generated objects use additionalProperties: false. This gives you a strict starting point that must still be edited to describe optional fields, accepted ranges, enums, formats, and alternative shapes.

MCP Tool Schema Generator with sample JSON and generated inputSchema
Turn representative MCP tool arguments into a reviewable JSON Schema starting point.

How to use

  1. Name the tool. Use a unique programmatic identifier such as search_docs.
  2. Describe the action. Explain what the tool does and when a model should call it.
  3. Add sample arguments. Paste valid JSON whose property names and value types match a realistic call.
  4. Generate the definition. Trexmi creates an object inputSchema and adds required and additionalProperties rules.
  5. Edit and validate. Mark optional fields correctly, add descriptions and constraints, then run MCP Schema Validator and your production SDK tests.
Built for the task

Why use MCP Tool Schema Generator?

Focused controls, predictable output, and a workflow designed around this exact transformation.

01

MCP-shaped output

Receive the core name, description, and inputSchema fields as copy-ready JSON.

02

Nested type inference

Objects, arrays, strings, integers, numbers, booleans, and null samples become schema nodes.

03

Strict starting point

Generated object schemas reject undeclared properties until you intentionally allow them.

04

Deterministic generation

No model call or external API is required to infer the initial schema.

Useful answers

Questions about MCP Tool Schema Generator

Practical details about input, output, privacy, limits, and the best way to use this tool.

01 What fields does the generator create?

It creates a minimal tool definition containing name, description, and inputSchema.

02 Which JSON Schema draft is declared?

The generated inputSchema declares JSON Schema Draft 2020-12.

03 Are all sample properties marked required?

Yes. A sample cannot reveal which fields are optional, so every observed property is initially required. Remove optional names from the required array manually.

04 How are arrays inferred?

The first array item determines the generated item schema. Review heterogeneous arrays and empty arrays manually.

05 Does the generator add field descriptions or enums?

No. A raw value cannot explain business meaning or the complete set of allowed values. Add descriptions, enum values, limits, patterns, and formats yourself.

06 Can I generate a tool with no arguments?

Yes. Use an empty JSON object and keep an object schema with additionalProperties: false.

07 Does this register a tool with an MCP server?

No. It only generates JSON. Registration and execution remain the responsibility of your MCP server or SDK.

08 Is production data sent to an AI model?

No external AI request is needed for generation. Even so, use sanitized samples rather than credentials or private customer data.

Examples

Generate a document-search tool

The sample establishes initial property names and primitive types.

Input
Tool name: search_docs
Description: Search product documentation for matching passages
Sample JSON:
{"query":"refund policy","limit":5,"include_archived":false}
Output
{
  "name": "search_docs",
  "description": "Search product documentation for matching passages",
  "inputSchema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "query": {"type": "string"},
      "limit": {"type": "integer"},
      "include_archived": {"type": "boolean"}
    },
    "required": ["query", "limit", "include_archived"],
    "additionalProperties": false
  }
}

Infer nested arguments

Nested objects are inferred recursively and array items use the first observed element.

Input
Tool name: create_ticket
Sample JSON:
{"customer":{"id":"cus_42","vip":true},"tags":["billing"]}
Output
customer → object
customer.id → string
customer.vip → boolean
tags → array of string

Wrap a non-object sample

MCP tool arguments are objects, so a scalar sample is exposed through a value property.

Input
Tool name: submit_score
Sample JSON:
42
Output
{
  "type": "object",
  "properties": {
    "value": {"type": "integer"}
  },
  "required": ["value"],
  "additionalProperties": false
}

The MCP tool definition generated

An MCP tool has a programmatic name, an optional human-readable description, and an inputSchema that describes its arguments. Current MCP documentation also defines optional display metadata, output schemas, annotations, icons, and extension metadata. This generator intentionally creates the portable core rather than guessing optional fields from data that cannot express them.

Choose a name that is unique within the server and stable across releases. Current MCP guidance recommends 1–128 ASCII letters, digits, underscores, hyphens, or dots. The description should distinguish the action from similar tools and state when it should be used.

How sample JSON becomes inputSchema

JSON objects become schemas with type: object. Each key becomes a property and its value supplies an initial type. Nested objects are processed recursively. Integers and decimal numbers remain distinct, booleans remain boolean, and strings remain string. A root scalar or array is wrapped in a value property because MCP tool arguments use an object input schema.

The generated schema includes a Draft 2020-12 identifier. MCP defaults tool schemas to Draft 2020-12 when no schema identifier is supplied, but an explicit identifier makes the intended dialect easier to audit.

Required fields, optional fields, and arrays

Inference can observe only the supplied example. It cannot know that limit is optional, that a string must be one of three enum values, or that an integer must fall within a range. Every observed property is therefore marked required. Remove optional names from required and add business constraints deliberately.

For an array, the first item supplies the item schema. An empty array has no evidence for an item type, and a heterogeneous array may contain shapes not represented by its first element. Add items, minItems, composition rules, or a manually reviewed object schema when the real contract is broader.

Generator limitations and edge cases

Sample-based generation does not infer descriptions, defaults, enum choices, formats, patterns, numeric boundaries, conditional rules, outputSchema, annotations, permissions, side effects, or confirmation requirements. A null sample proves only that the observed value is null; it does not identify the intended non-null type. Property names are preserved, while invalid characters in the tool name are normalized.

The generated definition does not test an MCP connection, call the tool, validate handler behavior, or prove that every client accepts the same schema features. Treat it as editable source code, not a completed security boundary.

MCP schema review workflow

Generate from a small representative object, then edit descriptions and optional fields. Check the result with MCP Schema Validator. For an OpenAI-specific tool wrapper, compare the structure using JSON to OpenAI Function Schema. Validate detailed JSON Schema constraints with JSON Schema Validator, then run calls through the exact MCP SDK and client versions used in production.

Official MCP and JSON Schema references

Review the current MCP tools specification and the JSON Schema Draft 2020-12 core specification before publishing a production tool.