Beginner-Friendly Topic
Take your time - it's perfectly normal to re-read this topic 2-3 times. Try the interactive code editor below to run code yourself. Use the Q&A section to check your understanding before moving on.You've got this!
What Is a Tool?
A tool is a function that the agent can call. It has a name, a description, defined input parameters, and a return value. The agent selects tools based on their descriptions.
8 min•By Priygop Team•Updated 2026
Tool Anatomy
Every tool has four parts:
- 1Name: a unique identifier the agent uses to refer to the tool (e.g., 'web_search')
- 2Description: a plain-English explanation of what the tool does and when to use it. The agent reads this to decide whether to use the tool.
- 3Parameters: the inputs the tool needs to run — each with a name, type, description, and whether it is required.
- 4Return value: what the tool gives back after running.
The description is the most important part. If it is unclear, the agent will misuse the tool or fail to use it when it should.
Minimal Tool Example
Minimal Tool Example
# The simplest possible tool definition
def get_current_date() -> str:
"""
Returns today's date in YYYY-MM-DD format.
Use this tool when the agent needs to know the current date.
"""
from datetime import date
return str(date.today())
# Tool metadata (what the agent reads)
tool_definition = {
"name": "get_current_date",
"description": "Returns today's date in YYYY-MM-DD format. Use when you need to know the current date.",
"parameters": {}, # No inputs needed
"returns": "string - date in YYYY-MM-DD format"
}
# Test the tool
result = get_current_date()
print(f"Tool result: {result}")