DevKits

JSON Schema to Tool Definition (OpenAI, Anthropic, Gemini)

Turn a sample JSON payload into function-calling / tool definitions for OpenAI, Anthropic, and Gemini — side by side. Strict-mode toggle adds required + additionalProperties: false. 100% local, paste straight into your tools array.

Last updated:

Comments

Paste a sample of the arguments your function takes and get OpenAI, Anthropic, and Gemini tool definitions side by side. Toggle strict mode to add required + additionalProperties: false. Copy the one you need straight into your tools array.

71 chars · 5 lines
{
  "name": "get_weather",
  "description": "Auto-generated from a sample JSON.",
  "parameters": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "get_weather",
    "type": "object",
    "properties": {
      "location": {
        "type": "string"
      },
      "unit": {
        "type": "string"
      },
      "days": {
        "type": "integer"
      }
    },
    "required": [
      "location",
      "unit",
      "days"
    ],
    "additionalProperties": false
  },
  "strict": true
}
{
  "name": "get_weather",
  "description": "Auto-generated from a sample JSON.",
  "input_schema": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "title": "get_weather",
    "type": "object",
    "properties": {
      "location": {
        "type": "string"
      },
      "unit": {
        "type": "string"
      },
      "days": {
        "type": "integer"
      }
    },
    "required": [
      "location",
      "unit",
      "days"
    ],
    "additionalProperties": false
  }
}
{
  "name": "get_weather",
  "description": "Auto-generated from a sample JSON.",
  "parameters": {
    "type": "object",
    "properties": {
      "location": {
        "type": "string"
      },
      "unit": {
        "type": "string"
      },
      "days": {
        "type": "integer"
      }
    },
    "required": [
      "location",
      "unit",
      "days"
    ],
    "additionalProperties": false
  }
}

Everything runs in your browser — your schema is never uploaded. Wrappers follow each provider's current function-calling / tool-use format. Paste the result straight into your tools array.

What is Schema → Tool Definition?

Function calling (a.k.a. tool use) lets an LLM return structured arguments for a function you define — but every provider wants the definition in a different envelope. OpenAI expects { name, description, parameters, strict } inside tools[].function; Anthropic expects { name, description, input_schema } inside tools[]; Gemini expects { name, description, parameters } inside functionDeclarations[]. The underlying JSON Schema is identical; only the wrapper differs. This tool infers a JSON Schema from one sample payload — detecting types, required keys, and common string formats like date-time, uuid, and uri — then wraps it three ways at once so you can paste the right shape into whichever SDK you're using.

How to generate tool definitions

  1. 1Paste an example of the arguments your function accepts.
  2. 2Set the function name (e.g. get_weather).
  3. 3Toggle strict mode if you want required + additionalProperties: false enforced.
  4. 4Copy the OpenAI, Anthropic, or Gemini block you need.

Use Cases

Port a tool between providers

Already have an OpenAI function? See the equivalent Anthropic and Gemini definitions instantly.

Bootstrap structured output

Turn a sample response into a strict schema so the model's output conforms exactly to your shape.

Key Concepts

JSON Schema
The vocabulary all three providers build their tool definitions on.
Strict mode
OpenAI's requirement that every property is required and additionalProperties is false.

Frequently Asked Questions

What's the difference between the three formats?

OpenAI wraps the schema as { name, description, parameters, strict } inside tools[].function. Anthropic uses { name, description, input_schema } inside tools[]. Gemini uses { name, description, parameters } inside functionDeclarations[]. The underlying JSON Schema is the same; only the envelope differs.

What does strict mode do?

Strict mode marks every property as required and sets additionalProperties: false on all objects. OpenAI's structured-output strict mode requires this; it makes the model's output conform exactly to your schema.

Do I paste a JSON Schema or a sample?

Paste a sample of the arguments your function takes — the tool infers the schema (types, required keys, string formats) automatically and wraps it for all three providers.

Try Next

Token Counter

Count tokens in your prompt for GPT-4, GPT-3.5, Claude, and Gemini and predict API cost before you spend. Free, no signup — all counting runs locally, your prompt stays in your browser.

Related Tools

Reference & Guides