induwara.lk
induwara.lkDeveloper · AI

Function Calling / Tool Use Schema Generator

Build a function-calling JSON schema once, then copy the exact wire format for OpenAI, Anthropic (Claude) and Google Gemini side by side. Enums, arrays, required fields and OpenAI strict mode handled. No API key, no signup, runs entirely in your browser.

By Induwara AshinsanaUpdated Jun 28, 2026
Build your tool schema
Cross-provider verified

snake_case recommended · letters, digits, _ or - · 1–64 chars.

The model reads this to decide when to call the tool.

Parameters (2)

OpenAI definition

Valid JSON · 27 lines
{
  "type": "function",
  "function": {
    "name": "get_weather",
    "description": "Get the current weather for a location",
    "parameters": {
      "type": "object",
      "properties": {
        "location": {
          "type": "string",
          "description": "City and country, e.g. Colombo, LK"
        },
        "unit": {
          "type": "string",
          "description": "Temperature unit",
          "enum": [
            "celsius",
            "fahrenheit"
          ]
        }
      },
      "required": [
        "location"
      ]
    }
  }
}
ProviderSchema object key
OpenAIparameters
Anthropicinput_schema
Geminiparameters

Sources cited: envelope key names verified against OpenAI's function-calling guide, Anthropic's tool-use docs, Google's Gemini function-calling docs, and the JSON Schema Draft 2020-12 core spec. Full links in the references section below. Everything runs in your browser — nothing is uploaded.

How it works

Function calling (OpenAI), tool use (Anthropic) and function declarations (Gemini) all solve the same problem: telling a model which functions it may call and what arguments each takes. Under the hood, every provider describes those arguments with the same JSON Schema vocabulary. Only the envelope around that schema changes from one SDK to the next — which is exactly the part that is easy to get wrong by hand.

This generator splits the job into two deterministic steps. First it builds the shared schema core from your parameter rows:

{
  "type": "object",
  "properties": {
    "<name>": { "type": "<type>", "description": "<text>" }
  },
  "required": ["<names where required = true>"]
}

A type of enum maps to { "type": "string", "enum": [...] } because an enum is a constraint, not a JSON type. An array becomes { "type": "array", "items": { "type": "<scalar>" } }. An empty required array is omitted entirely, matching how the providers document the zero-required case.

Second, it wraps that core in each provider's documented shape. OpenAI's Chat Completions nests it under function.parameters inside a { "type": "function" } object; Anthropic puts it at the top level under input_schema; Gemini nests it inside function_declarations[]. When you turn on OpenAI strict mode(Structured Outputs), the tool follows OpenAI's three documented rules: it sets strict: true, adds additionalProperties: false, and promotes every property into required, then warns you which optional fields it had to promote.

Generation is referentially transparent: identical inputs always produce byte-identical output. Two checks back the credibility badge — the schema core is compared across all three providers to confirm it is identical, and the final string is round-tripped through JSON.parse so the output is guaranteed to be valid JSON for every input combination.

Worked examples

get_weather(location, unit) — OpenAI, strict off

  1. location: string, required, 'City and country, e.g. Colombo, LK'
  2. unit: enum [celsius, fahrenheit], optional, 'Temperature unit'
  3. Core: type object + properties + required:[location]
  4. unit is optional → absent from required
  5. enum → { type: string, enum: [...] }
  6. Wrapped as { type: 'function', function: { name, description, parameters } }

Same function — Anthropic vs Gemini envelope

  1. Identical schema core to the OpenAI example
  2. Anthropic: { name, description, input_schema: <core> }
  3. Gemini: { function_declarations: [ { name, description, parameters: <core> } ] }
  4. Cross-check: all three cores are byte-identical ✓

get_weather with strict mode ON (OpenAI)

  1. Toggle OpenAI strict mode
  2. function gains strict: true
  3. parameters gains additionalProperties: false
  4. unit promoted into required → required:[location, unit]
  5. Chip warns: 1 optional parameter promoted — no optional fields in strict mode

Frequently asked questions

Sources & references

Each provider's envelope key names were last cross-checked against the official docs on 2026-06-28. The generator is updated whenever a provider changes its documented format.

Related tools

Rate this tool
Be the first to rate

Comments & feedback

Spotted a bug or want an improvement? Tell us — our team reviews every comment, and good ideas get built. Comments are public and anonymous.

Found a bug, edge case, or want a provider or schema keyword added?

Email me at [email protected] — most fixes ship within 24 hours.