1. Weather Tool Payloads for Multiple Providers
AI EngineerBackground
An engineer is integrating a weather lookup capability across an application supporting both Claude and GPT-4o.
Problem
Writing separate JSON schemas for OpenAI and Anthropic by hand creates subtle syntax errors and 400 Bad Request responses.
How to use
Set Tool name to get_weather, enter the description, add parameters for city, unit enum, and forecast days, and select Auto for tool_choice.
Tool Name: get_weather
Tool Description: Get the current weather for a city. Use when the user asks about temperature, conditions, or whether it will rain today.
Parameters:
city | string | required | City name, e.g. "Paris"
units | enum<celsius,fahrenheit> | optional | Temperature unit for the report
forecast_days | integer | optional | Days of forecast to include (1-7)
Strict Mode: true
Tool Choice: autoOutcome
Produces validated OpenAI, Anthropic, and Gemini tool payloads alongside a validation table highlighting nullable union handling for optional fields.