What is a tool schema?
A tool schema is a structured definition that tells an AI agent what a tool does and what inputs the tool expects.
It acts like a contract between the model and the tool.
Instead of generating arbitrary text, the agent produces arguments that follow this predefined structure.
What a tool schema usually defines
A schema may describe:
- the tool name
- what the tool is used for
- available arguments
- argument data types
- required fields
- optional fields
- allowed values
- nested structures
- validation constraints
This gives the model enough information to construct a valid tool call.
Example
Imagine a tool called:
create_support_ticket
Its schema may define these arguments:
- title: string, required
- description: string, required
- priority: low, medium, or high
- customer_id: string, required
If the user says:
“Create a high-priority ticket for customer C123 because their payment failed.”
the agent can map the request into the expected structure:
- title: Payment failure
- description: Customer payment failed
- priority: high
- customer_id: C123
The runtime can then validate and execute the call.
Schemas make arguments predictable
Without a schema, the model might generate:
priority = urgent
But if the schema allows only:
- low
- medium
- high
the system can reject or correct the unsupported value before execution.
This reduces ambiguity.
Required fields tell the agent what must be provided
Suppose a tool requires:
- account_id
- amount
If the agent has the amount but not the account ID, the schema makes that missing information visible.
The agent may then:
- retrieve the account ID from another tool
- use trusted context
- ask the user for the missing information
It should not silently invent a required value.
Data types improve reliability
A schema can specify that:
- amount must be a number
- quantity must be an integer
- email must be a string
- items must be an array
- options must be an object
This allows the runtime to detect malformed arguments before the tool receives them.
Schemas can constrain values
A tool may accept only specific values.
For example:
environment
- development
- staging
- production
or:
priority
- low
- medium
- high
These constraints reduce invalid tool calls and make behavior more deterministic.
Descriptions are part of good schema design
Argument names alone are sometimes not enough.
For example:
id
is ambiguous.
A clearer field is:
customer_id
with a description such as:
“Unique identifier of the customer whose account should be retrieved.”
Clear descriptions help the model choose the correct values.
A schema does not enforce authorization by itself
A valid tool call is not automatically an authorized tool call.
For example, an agent may correctly generate:
refund_amount = 50,000
but the current user may only be authorized to refund up to 5,000.
The schema checks structure.
The surrounding application should still enforce:
- permissions
- business rules
- approval requirements
- security policies
Some values should not be exposed in the schema for the model to choose
Sensitive context such as:
- authenticated user ID
- tenant ID
- credentials
- authorization scope
should often come from the trusted runtime rather than from model-generated arguments.
For example:
Model supplies: order_id
Runtime supplies: authenticated_user_id
This keeps security boundaries outside model reasoning.
Tool schemas also help tool selection
A tool schema does more than validate arguments.
Its name, description, and input definition also help the model determine whether the tool fits the task.
For example:
A tool requiring an exact order ID may be unsuitable when the user only provides an email address.
The agent may first choose a search tool instead.
Good schemas are narrow and clear
A tool with dozens of loosely defined parameters is harder for an agent to use correctly.
Good schemas generally have:
- clear names
- focused responsibilities
- well-described arguments
- meaningful constraints
- predictable outputs
This reduces tool-selection and argument-generation errors.
What happens after the schema is used?
A typical flow is:
- The model reads the available tool definitions.
- It selects a tool.
- It generates arguments matching the schema.
- The runtime validates the arguments.
- Authorization and business rules are checked.
- The tool executes.
- The result returns to the agent.
The schema therefore sits between model reasoning and actual execution.
In short
A tool schema is the structured contract that defines how an AI agent should call a tool.
It tells the agent which arguments exist, which are required, what types and values are allowed, and what the tool is intended to do. Clear schemas make tool calls more reliable, easier to validate, and safer to execute.
Learning Sequence
AI Agents Curriculum
Explore Related Questions
Deepen your understanding across related AI Agents topics.