Intermediate level · Module 3: Agent Tools and Function Calling · Lesson 1 of 3
Describing Tools for a Model
Learners write tool names, descriptions and argument schemas (generated from Pydantic models) that help the model choose correctly and make misuse hard.
In this lesson you will
- Write clear tool descriptions
- Generate argument schemas from Pydantic models
Key concepts
tool name and descriptionargument schemamodel_json_schema()required argumentsnarrow tools
The lesson
Function calling lets a model request a tool by name with JSON arguments. Providers differ in exact formats, but all need a name, a description and a JSON Schema for the arguments. A Pydantic model's model_json_schema() produces that schema.
Descriptions should say what the tool does, when to use it and what it returns: 'Search the approved project reports. Use for questions about project activities and results. Returns up to five passages with document IDs.'
Prefer narrow tools (get_course_levels(name)) over broad ones (run_sql(query)). Narrow tools are easier for the model to use correctly and much harder to misuse.
Step by step
- Define two tools for the project as Pydantic argument models.
- Generate and inspect their JSON schemas.
- Write descriptions with when-to-use guidance.
- Compare a narrow and a broad tool design for the same need.
Practice activity
Specify the project's tools with schemas and descriptions.
Expected result: Clear, narrow tools with generated schemas.
Check your understanding
-
What three things does a model need to know about a tool?
Show answer
Its name, description and argument schema.
-
Why prefer narrow tools over a general run_sql tool?
Show answer
They are easier to use correctly and much harder to misuse.
Further learning
Taught live by an instructor — online or in person. Free course lessons are for self-study and do not lead to a certificate — see registration options.