MCP Server Generator
Free tool · Runs in your browser

MCP Tool Schema Generator

Design the tools of an MCP server in a form and get the exact JSON a client sees in tools/list: name, title, description, an inputSchema with typed properties and a required list, and optional annotations. The same definition is written as TypeScript (Zod) or Python (mcp) code, or downloaded as a runnable project. Paste an existing definition, including one with an outputSchema, to validate it. Everything runs in your browser.

Build MCP tool definitions

Tools


      

Validate an MCP tool definition

    What an MCP tool definition contains

    • name: the identifier the model calls. Keep it short, unique within the server and limited to letters, digits, _, - and ..
    • title (optional): a human-readable label that hosts may show in their UI.
    • description: the most important field. The model reads it to decide when to call the tool, so say what it does, what it returns and when to use it.
    • inputSchema: a JSON Schema object. Each property has a type and a description; required ones are listed in required. A tool with no arguments still needs {"type": "object", "properties": {}}.
    • outputSchema (optional): a JSON Schema for the structured result. If you declare it, every successful call must return a matching structuredContent. See outputSchema and structuredContent.
    • annotations (optional): behaviour hints such as readOnlyHint and destructiveHint. See the annotations table.

    Type mapping

    Builder typeJSON SchemaTypeScript (Zod)Python
    string{"type": "string"}z.string()str
    number{"type": "number"}z.number()float
    integer{"type": "integer"}z.number().int()int
    boolean{"type": "boolean"}z.boolean()bool
    enum{"type": "string", "enum": [...]}z.enum([...])Literal[...]
    array of strings{"type": "array", "items": {"type": "string"}}z.array(z.string())list[str]
    array of numbers{"type": "array", "items": {"type": "number"}}z.array(z.number())list[float]

    Optional parameters get .optional() in Zod and | None = None in Python, and are left out of required. Parameter names that clash with Python or JavaScript keywords, such as class, get a trailing underscore so both languages accept them.

    Checked against the real SDKs

    On 2026-10-19 we built a tool with every type above plus annotations, downloaded both projects, and ran them: @modelcontextprotocol/sdk 1.32.1 on Node 20 and mcp 2.3.0 on Python 3.13. An MCP client listed the tools from each server. Every name, title, description, annotation, property type, enum, array item type and required list matched the JSON this page shows. A call with an enum value outside the list came back as an error, as it should.

    The SDKs add a few fields of their own. TypeScript adds "additionalProperties": false and a $schema line. Python adds a title to every property, writes optional parameters as anyOf with null, and adds an outputSchema for the str return value.

    MCP tool schema example: inputSchema, outputSchema and annotations

    Two tools from a small orders server. get_order_status reads data and declares an outputSchema; cancel_order changes data and has no structured output. This is the exact tools/list result the server returned to an MCP client:

    {
      "tools": [
        {
          "name": "get_order_status",
          "title": "Get order status",
          "description": "Look up one order by its ID and return its status and total. Use it when the user names a specific order.",
          "inputSchema": {
            "type": "object",
            "properties": {
              "order_id": { "type": "string", "description": "Order ID, for example A-1001" }
            },
            "required": ["order_id"]
          },
          "outputSchema": {
            "type": "object",
            "properties": {
              "order_id": { "type": "string" },
              "status": { "type": "string", "enum": ["pending", "shipped", "delivered"] },
              "total": { "type": "number", "description": "Order total in USD" }
            },
            "required": ["order_id", "status", "total"]
          },
          "annotations": { "readOnlyHint": true, "openWorldHint": false }
        },
        {
          "name": "cancel_order",
          "title": "Cancel order",
          "description": "Cancel a pending order. Shipped orders cannot be cancelled. Ask the user to confirm first.",
          "inputSchema": {
            "type": "object",
            "properties": {
              "order_id": { "type": "string", "description": "Order ID to cancel" }
            },
            "required": ["order_id"]
          },
          "annotations": { "readOnlyHint": false, "destructiveHint": true, "idempotentHint": true, "openWorldHint": false }
        }
      ]
    }

    Calling get_order_status with {"order_id": "A-1001"} returned both a text block and the structured result:

    {
      "content": [
        { "type": "text", "text": "{\"order_id\":\"A-1001\",\"status\":\"shipped\",\"total\":42.5}" }
      ],
      "structuredContent": { "order_id": "A-1001", "status": "shipped", "total": 42.5 }
    }

    We ran this on 2026-10-21 with @modelcontextprotocol/sdk 1.32.1 on Node 20 (low-level Server, stdio). Pasting the tools/list result into the validator above gives 0 errors and 0 warnings. When we changed the server to return total as a string, the SDK client refused the result with MCP error -32602: Structured content does not match the tool's output schema: data/total must be number. Calling cancel_order on a shipped order returned isError: true with a readable message, which is how a tool should report a failure the model can act on.

    outputSchema and structuredContent

    inputSchema describes the arguments; outputSchema describes what a successful call returns. It is optional. The rules from the MCP specification:

    • If a tool declares an outputSchema, the server must return structuredContent that conforms to it, and clients should validate it (the TypeScript SDK client does, as the example shows).
    • For older clients, also return the same data serialized as JSON in a text content block.
    • Up to spec revision 2025-11-25, outputSchema and structuredContent were objects. Revision 2026-07-28 adopted SEP-2106: outputSchema may be any JSON Schema 2020-12 (an array, a number, a composition), and structuredContent may be any JSON value. inputSchema must still be "type": "object".
    • If your users run older hosts, keep the output an object (for example {"orders": [...]} instead of a bare array). The validator accepts a non-object outputSchema and adds a note about this.

    The builder on this page can generate an object outputSchema: turn on Declare outputSchema for a tool and add output fields the same way you add parameters (name, type, description, required). The tools/list JSON, TypeScript (outputSchema: z.object(...) plus structuredContent) and Python (TypedDict return) all include it. Non-object schemas (array or primitive, allowed since spec 2026-07-28 / SEP-2106) are not in the form builder—paste those into the validator, which still checks them. Empty output fields with the checkbox on produce { "type": "object", "properties": {} }.

    MCP tool annotations: readOnlyHint, destructiveHint, idempotentHint, openWorldHint

    Annotations tell the host how a tool behaves so it can decide whether to ask the user first. All four are booleans, all are optional, and the defaults are the cautious answer:

    HintMeaning when trueDefault if missingWhat a host may do
    readOnlyHintThe tool does not modify its environmentfalseSkip the confirmation prompt
    destructiveHintThe tool may delete or overwrite data (false = additive only)trueWarn before running
    idempotentHintCalling again with the same arguments has no extra effectfalseRetry safely after a failure
    openWorldHintThe tool reaches external systems (web, third-party APIs)trueTreat the output as untrusted content

    destructiveHint and idempotentHint only mean something when readOnlyHint is false. A write tool that leaves destructiveHint out is treated as destructive, so set "destructiveHint": false on tools that only add records. Annotations can also carry a title, but the tool-level title field is the usual place for it.

    Annotations are hints. The specification says clients must treat them as untrusted unless the server is trusted, so they shape the user experience, not security. The validator warns when readOnlyHint and destructiveHint are both true, notes hints that have no effect, and flags write tools without destructiveHint. The OpenAPI to MCP converter sets them from the HTTP method (GET is read-only, DELETE is destructive, PUT and DELETE are idempotent).

    How to write an MCP tool description (and how long it can be)

    The model chooses a tool from its name and description, so the description does more work than any other field. A useful pattern:

    1. Start with a verb and the result: "Look up one order by its ID and return its status and total."
    2. Say when to use it, and when not to if a sibling tool is close: "Use it when the user names a specific order."
    3. Name hard limits or side effects: "Shipped orders cannot be cancelled. Ask the user to confirm first."
    4. Put parameter details in each property's description, not in the tool description.

    Length. The MCP specification sets no limit on description (tool names should be 1 to 128 characters). Hosts do set limits. Claude Code cuts the description of a tool that loads upfront at 4,096 characters and of a tool loaded through tool search at 16,384, and before v2.1.296 the limit was 2,048; CLAUDE_CODE_MAX_MCP_DESCRIPTION_LENGTH changes it. Every description is sent with every request, so shorter is cheaper. The validator notes descriptions over 1,000 characters and warns over 2,048 and 4,096.

    Ready to run these tools?

    Download a ZIP above, or use the main generator for a quick string, number and boolean server. Then add it to your host with the config generator.

    FAQ

    What is an MCP tool schema?

    It is the inputSchema of a tool: a JSON Schema object with "type": "object", a properties map and a required list. The server returns it in tools/list, the host passes it to the model, and the model uses it to build the arguments of each call.

    How do I mark a parameter as required in an MCP tool?

    List its name in the required array of the inputSchema, next to properties. Writing "required": true inside the property itself is an older JSON Schema habit that MCP clients ignore; the validator flags it.

    Is inputSchema the same as OpenAI parameters or Anthropic input_schema?

    The JSON Schema inside is the same idea, but the key differs: OpenAI function calling uses parameters, the Anthropic API uses input_schema, and MCP uses inputSchema. Paste a definition from either API into the validator and it tells you which key to rename; Load into builder converts the properties.

    What are MCP tool annotations?

    Optional hints about behaviour: readOnlyHint, destructiveHint, idempotentHint and openWorldHint. Hosts can use them to decide when to ask for confirmation. They are hints from the server, so clients should not treat them as a security guarantee.

    Which characters can an MCP tool name use?

    The MCP specification recommends 1 to 128 characters from A-Z, a-z, 0-9, underscore, hyphen and dot, with names unique within a server. The builder keeps hyphens and dots in the tool name and derives a valid Python function name separately.

    Why does the Python SDK show anyOf and title in the schema?

    Pydantic writes an optional int | None parameter as anyOf integer or null with a default of null, and adds a title to each property. The TypeScript SDK adds additionalProperties: false and a $schema line. Both are valid JSON Schema and models handle them; the builder shows the minimal form.

    What is outputSchema in an MCP tool?

    An optional JSON Schema that describes the structured result of a tool. If a tool declares it, the server must return structuredContent that matches it, and should also return the same JSON as text for older clients. The TypeScript SDK client rejects a result that does not match.

    Can an MCP outputSchema be an array?

    Since spec revision 2026-07-28 (SEP-2106), yes: outputSchema can be any JSON Schema 2020-12 and structuredContent any JSON value. Clients built for 2025-11-25 and earlier expect an object, so wrap arrays in an object if you need to support them. inputSchema must still be type object.

    How do I generate an MCP outputSchema?

    In the builder, check Declare outputSchema on a tool, then add output fields (name, type, description, required). The page emits an object outputSchema in the tools/list JSON, adds outputSchema: z.object(...) and a matching structuredContent return in TypeScript, and a TypedDict return in Python. For array or primitive output schemas, paste a full tool definition into the validator instead—the form builder only builds object schemas.

    What are the default values of MCP tool annotations?

    readOnlyHint defaults to false, destructiveHint to true, idempotentHint to false and openWorldHint to true. destructiveHint and idempotentHint only apply when readOnlyHint is false, so a write tool that adds data without deleting anything should set destructiveHint to false.

    How long can an MCP tool description be?

    The MCP specification sets no limit. Claude Code cuts the description of a tool that loads upfront at 4,096 characters (2,048 before v2.1.296) and of a tool loaded through tool search at 16,384. Put the key facts first.