What you can do with OpenAI & Claude Function / Tool Spec Builder
- Create openai function definition
- Generate claude tool spec
How this AI tool works
Infer an object argument schema from sample JSON and format it as either an OpenAI function tool or an Anthropic Claude tool.
Example input
{"location":"San Francisco, CA","options":{"unit":"celsius"}}Example output
{"type":"function","function":{"name":"get_weather","description":"Fetch current weather data for a city.","parameters":{"type":"object","properties":{"location":{"type":"string"},"options":{"type":"object","properties":{"unit":{"type":"string"}},"required":["unit"]}},"required":["location","options"]}}}Practical workflow
- Enter your tool function name and a clear description explaining when the model should invoke it.
- Paste a JSON object showing the tool arguments you expect the model to provide.
- Review the inferred nested object and array types; every property in the sample is marked required.
- Choose OpenAI function or Claude tool format, then copy the matching JSON payload.
Common use cases
- Building autonomous AI agents equipped with reliable external API capabilities.
- Translating REST API endpoints into deterministic function-calling specifications.
- Creating provider-specific tool definitions from an example request object.
Important notes and limitations
- The argument sample must be a JSON object. A single sample cannot reveal optional fields or enum choices, so all observed properties are marked required.
- Nested object and array types are inferred from the sample. The input is capped at 1,000,000 characters, stays in the open tab, and is not sent to either provider.
OpenAI & Anthropic Function Calling JSON schemas
Inspect tool spec with OpenAI CLI
curl https://api.openai.com/v1/chat/completions -H "Authorization: Bearer $OPENAI_API_KEY" -H "Content-Type: application/json" -d '{"model":"gpt-4o","tools":[{"type":"function","function":{"name":"query_db","parameters":{"type":"object","properties":{"sql":{"type":"string"}},"required":["sql"]}}}]}'Submits JSON Schema function specifications enabling model tool calling.
Function schema compilation & type validation
Invalid schema for function '...': missing 'required' array
Cause: OpenAI Strict Tools require every parameter to be explicitly listed in the 'required' array.
Solution: Include all properties in 'required' and use 'type: ["string", "null"]' for optional parameters under strict mode.
Model invents non-existent function arguments (Tool hallucination)
Cause: Vague or missing property descriptions in the function schema.
Solution: Provide clear, unambiguous 'description' fields for every parameter explaining format, constraints, and valid enums.
Continue your workflow
- JSON Schema Validator — validate JSON payloads against complex Draft-07 schemas.
- Codebase to Prompt — package your backend handler code alongside tool definitions.
- AI Compatibility Checker — Check system prompts and tool schemas across OpenAI, Anthropic, and Gemini models.
Frequently asked questions
What is the difference between OpenAI function calling and Claude tool use schemas?
OpenAI nests properties under a parameters object following JSON Schema, while Anthropic Claude specifies input_schema at the top level of the tool specification.
How are types and required fields inferred from my sample?
JSON value types are inferred recursively, including nested objects and arrays. Every property present in the single sample is marked required; optional fields and enum values cannot be inferred from one example.
Can I generate schemas directly from existing JSON API responses?
Yes. You can paste sample JSON objects to automatically infer property types, nested arrays, and required fields.