OpenAI Function Schema Generator

Paste sample arguments, get a ready-to-paste OpenAI tool-calling schema — name validated, JSON Schema inferred automatically. 100% in your browser, no API key needed.

Sample Arguments (JSON)
// Paste sample arguments to generate a tool definition

What is this tool for?

Writing an OpenAI tool-calling schema by hand means manually building a JSON Schema for every argument, one property at a time. This tool infers the schema from a real example instead — paste JSON shaped like the arguments you expect the model to send, and it generates the full tools array entry: name, description, and a parameters JSON Schema with types and required fields already filled in.

The generated schema is a starting point, not a final answer — you'll typically want to add per-property descriptions, mark some fields optional, or add an enum constraint after generating. But going from a blank page to a valid, correctly-shaped schema in one paste saves real time.

How to generate a function schema — 3 steps

  1. Name your function. Use snake_case or camelCase — OpenAI requires 1-64 characters, letters/numbers/underscores/hyphens only. The tool flags invalid names immediately.
  2. Write a one-line description. This is what the model actually reads to decide whether to call your function — be specific about what it does and when it applies.
  3. Paste example arguments. Real JSON with realistic values — the tool infers types (string, integer, number, boolean, array, object) directly from what you provide.

Real Schema Inference

Types are detected from your actual sample values — integers vs. floats, arrays with typed items, and nested objects are all handled, not just flat string fields.

Name Validation Built In

OpenAI rejects function names outside its 1-64 character, alphanumeric/underscore/hyphen pattern. This tool checks that before you copy, not after an API error.

No API Key Required

Schema generation is pure JSON transformation — it never calls OpenAI or any other API, so there's nothing to configure and nothing sent over the network.

Common use cases

  • check_circleScaffolding a new tool definition when wiring up OpenAI function calling
  • check_circleQuickly converting an existing internal API's request shape into a valid tool schema
  • check_circleChecking a function name against OpenAI's naming rules before deploying
  • check_circlePrototyping multiple tool definitions during early agent-design work
  • check_circleGenerating a starting-point parameters schema to hand-refine with enums and descriptions

Working with AI APIs?

Check token counts before you send a request, or convert JSON structures with the tools below.

Frequently Asked Questions

What is an OpenAI function/tool schema?

It's the JSON structure you pass in the tools array of a Chat Completions or Responses API call to let the model call your own functions. Each entry has a name, an optional description, and a parameters field — a JSON Schema object describing the arguments the model should provide when it decides to call that function.

How does this tool generate the schema?

Paste a realistic example of the arguments your function expects (real JSON, with real value types), and the tool infers a JSON Schema from it — same field names, with types (string, integer, number, boolean, array, object) detected from the sample values, all fields marked required by default. Adjust the generated schema afterward for optional fields, enums, or descriptions per property.

What are OpenAI's naming rules for functions?

Function names must be 1–64 characters, using only letters, numbers, underscores, and hyphens — no spaces or other punctuation. This tool checks your name against that pattern and flags it before you copy the schema, so you don't find out from an API error instead.

Does this call the OpenAI API to generate the schema?

No. The JSON Schema inference and the OpenAI tool-format wrapping both happen entirely in your browser with plain JavaScript — no API key, no network request, and no cost. Nothing you type here is sent anywhere.

Can I use this for Claude or Gemini tool calling too?

The generated parameters object is standard JSON Schema, which Claude's and Gemini's tool-calling formats also use for argument definitions — but the outer wrapper differs (Claude uses input_schema directly on the tool object, not a nested function key). Use the parameters block from this tool's output and adjust the surrounding structure to match whichever API you're targeting.