A JSON schema for tool arguments is a machine-readable description of what inputs a tool expects, including the names, types, and constraints of its parameters.
When an LLM calls a tool, it needs a reliable way to format the arguments so the tool can actually run. A JSON schema helps by telling the model and the application:
In practice, teams use this to reduce malformed tool calls, make tool use more predictable, and catch errors early. It is especially useful when an agent can choose among many tools or when a single tool has several parameters.
A tool definition usually includes a name, a description, and an input schema written in JSON Schema. The schema describes the shape of the argument object the tool expects.
At runtime, the model produces arguments that should match that schema. For example, if a tool takes city and units, the schema can say city is a string, units is one of a fixed set of strings, and city is required.
The application can then validate the generated arguments against the schema before calling the tool. If the arguments do not match, the app can reject them, ask the model to try again, or repair them depending on its workflow.
A small but important point: “JSON schema” here usually means a JSON Schema-style contract for the tool’s input, not a general schema for all data in the system.
Tool: get_weather
Schema-like input shape:
{
"type": "object",
"properties": {
"city": { "type": "string" },
"units": { "type": "string", "enum": ["metric", "imperial"] }
},
"required": ["city"],
"additionalProperties": false
}
Valid tool arguments:
{
"city": "Paris",
"units": "metric"
}
Invalid tool arguments:
{
"city": 42,
"units": "kelvin"
}
If you need the model to choose values from a closed set or fill in a structured request, a JSON schema is usually the right starting point. If the input is highly unstructured, plain text may be simpler.