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:
CommentsPaste 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.
{
"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
- 1Paste an example of the arguments your function accepts.
- 2Set the function name (e.g. get_weather).
- 3Toggle strict mode if you want required + additionalProperties: false enforced.
- 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
Prompt Cache Calculator
See how much prompt caching saves you. Enter your cached prefix size, per-request tokens, volume, and hit rate to compare cost with and without caching across models that support it. 100% local.
Batch API Cost Calculator
Compare real-time vs Batch API cost for a bulk job. Enter request count and per-request tokens to see how much the ~50% batch discount saves across models that support it. 100% local.
Prompt Injection Detector
Scan untrusted user input for common prompt-injection and jailbreak patterns — instruction overrides, jailbreak personas, system-prompt exfiltration — with a risk score. Heuristic, 100% local.
Text Chunker
Split long text into overlapping chunks for embedding and RAG pipelines. Preview recursive, paragraph, sentence, or fixed strategies with live token counts. Runs 100% in your browser.
Cosine Similarity
Compute cosine similarity, dot product, and Euclidean distance between two vectors online. Perfect for debugging LLM embeddings, semantic search, and RAG pipelines. 100% local — vectors never leave your browser.
AI Cost Calculator
Estimate monthly LLM API cost across GPT-4o, Claude 3.5, Gemini, DeepSeek and 100+ models. Compare providers side-by-side with prompt-caching and batch discounts. Free, no signup — prices refreshed daily from the public LiteLLM catalog.