Bird
Raised Fist0
Agentic AIml~20 mins

Defining tool schemas and descriptions in Agentic AI - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

Jump into concepts and practice - no test required

or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Challenge - 5 Problems
🎖️
Tool Schema Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Understanding Tool Schema Purpose
Why is defining a clear schema important when creating a tool description for an AI agent?
AIt allows the AI agent to ignore the tool's inputs and focus on outputs only.
BIt makes the tool run faster by optimizing its code automatically.
CIt ensures the AI agent understands the tool's inputs, outputs, and usage constraints.
DIt prevents the AI agent from using the tool in any context.
Attempts:
2 left
💡 Hint
Think about how an AI agent decides when and how to use a tool.
Predict Output
intermediate
1:00remaining
Output of a Tool Schema Definition
What is the output of this Python code defining a simple tool schema dictionary?
Agentic AI
tool_schema = {
    "name": "calculator",
    "description": "Performs basic arithmetic operations",
    "inputs": {"operation": "str", "x": "float", "y": "float"},
    "outputs": {"result": "float"}
}
print(tool_schema["inputs"])
A{'result': 'float'}
BTypeError: unhashable type: 'dict'
C['operation', 'x', 'y']
D{'operation': 'str', 'x': 'float', 'y': 'float'}
Attempts:
2 left
💡 Hint
Look at the key used inside the print statement.
Model Choice
advanced
1:30remaining
Choosing the Best Schema Format for Tool Description
Which data format is best suited for defining tool schemas to be used by AI agents for interoperability and easy parsing?
ABinary serialized objects without human readability
BJSON Schema with strict typing and validation rules
CPlain text with informal descriptions
DUnstructured XML without schema definitions
Attempts:
2 left
💡 Hint
Consider formats that support validation and are widely supported.
Hyperparameter
advanced
1:30remaining
Adjusting Tool Schema Complexity
When defining a tool schema for an AI agent, which hyperparameter adjustment helps balance between schema detail and agent performance?
AAdding precise data types and required fields only for essential inputs
BIncreasing the number of input fields without constraints
CRemoving all output descriptions to simplify the schema
DUsing vague descriptions to allow flexible input types
Attempts:
2 left
💡 Hint
Think about how too much or too little detail affects the AI agent's ability to use the tool.
🔧 Debug
expert
2:00remaining
Debugging a Tool Schema Description Error
Given this tool schema snippet, what error will occur when an AI agent tries to parse it? { "name": "weather_tool", "description": "Fetches weather data", "inputs": { "location": "string", "date": "date" }, "outputs": { "temperature": "float", "condition": "string" }, "required": ["location", "time"] }
AKeyError because 'time' is not defined in inputs
BTypeError because 'date' is not a valid data type
CNo error, schema is valid
DValueError because outputs are missing required fields
Attempts:
2 left
💡 Hint
Check the required fields against the inputs keys.

Practice

(1/5)
1. What is the main purpose of defining a tool schema in agentic AI?
easy
A. To describe what the tool does and what inputs it needs
B. To write the tool's source code
C. To train the AI model
D. To store user data securely

Solution

  1. Step 1: Understand the role of tool schemas

    Tool schemas explain what a tool does and what inputs it requires for proper use.
  2. Step 2: Differentiate from other tasks

    Writing code, training models, or storing data are separate tasks not covered by schemas.
  3. Final Answer:

    To describe what the tool does and what inputs it needs -> Option A
  4. Quick Check:

    Tool schema = tool description + inputs [OK]
Hint: Schemas explain tool purpose and inputs clearly [OK]
Common Mistakes:
  • Confusing schema with code implementation
  • Thinking schema trains the AI
  • Assuming schema stores data
2. Which of the following is the correct way to define a tool schema description in JSON format?
easy
A. {"name": search, "desc": "Finds info", inputs: {query: string}}
B. {"tool": search, description: Finds info, inputs: query string}
C. {"name": "search", "description": "Finds information", "inputs": {"query": "string"}}
D. {name: "search", description: "Finds information", inputs: {query: string}}

Solution

  1. Step 1: Check JSON syntax correctness

    {"name": "search", "description": "Finds information", "inputs": {"query": "string"}} uses proper JSON with keys and string values quoted correctly.
  2. Step 2: Verify key names and structure

    {"name": "search", "description": "Finds information", "inputs": {"query": "string"}} uses "name", "description", and "inputs" keys properly with correct value types.
  3. Final Answer:

    {"name": "search", "description": "Finds information", "inputs": {"query": "string"}} -> Option C
  4. Quick Check:

    Valid JSON with quoted keys and strings = {"name": "search", "description": "Finds information", "inputs": {"query": "string"}} [OK]
Hint: Look for quoted keys and string values in JSON [OK]
Common Mistakes:
  • Missing quotes around keys or strings
  • Using unquoted identifiers
  • Incorrect key names or structure
3. Given this tool schema snippet:
{"name": "calculator", "description": "Performs math operations", "inputs": {"operation": "string", "x": "number", "y": "number"}}

What would be the expected output if the tool is called with inputs {"operation": "add", "x": 5, "y": 3}?
medium
A. 8
B. "add"
C. 53
D. Error: missing inputs

Solution

  1. Step 1: Understand the tool schema inputs

    The tool expects an operation (like add) and two numbers x and y.
  2. Step 2: Apply the operation to inputs

    Adding 5 and 3 results in 8 as output.
  3. Final Answer:

    8 -> Option A
  4. Quick Check:

    5 + 3 = 8 [OK]
Hint: Match inputs to operation and compute result [OK]
Common Mistakes:
  • Returning operation string instead of result
  • Concatenating numbers as strings
  • Assuming missing inputs cause error
4. You have this tool schema:
{"name": "translator", "description": "Translates text", "inputs": {"text": "string", "target_lang": "string"}}

Which error is present in this schema?
medium
A. Description is too long
B. Name key is missing
C. Input types should be numbers
D. Missing closing brace for inputs object

Solution

  1. Step 1: Check JSON syntax carefully

    The inputs object is opened but not closed with a } before the schema ends.
  2. Step 2: Verify other keys

    Name key exists, description length is fine, input types as strings are correct.
  3. Final Answer:

    Missing closing brace for inputs object -> Option D
  4. Quick Check:

    Unclosed braces cause JSON errors [OK]
Hint: Count opening and closing braces carefully [OK]
Common Mistakes:
  • Ignoring missing braces
  • Thinking input types must be numbers
  • Assuming description length matters
5. You want to define a tool schema for a weather forecast tool that takes a city name and date, and returns temperature and conditions. Which schema correctly describes this tool?
hard
A. {"name": "weather", "description": "Forecast tool", "inputs": {"city": "string"}, "outputs": {"temp": "string", "cond": "string"}}
B. {"name": "weather", "description": "Provides weather forecast", "inputs": {"city": "string", "date": "string"}, "outputs": {"temperature": "number", "conditions": "string"}}
C. {"name": "weather", "description": "Gives weather", "inputs": {"location": "string", "day": "date"}}
D. {"name": "weather", "inputs": {"city": "string", "date": "string"}}

Solution

  1. Step 1: Check completeness of schema

    {"name": "weather", "description": "Provides weather forecast", "inputs": {"city": "string", "date": "string"}, "outputs": {"temperature": "number", "conditions": "string"}} includes name, description, inputs (city and date), and outputs (temperature and conditions) as required.
  2. Step 2: Verify input and output types

    Inputs are strings (city, date), outputs are number and string, matching expected data.
  3. Final Answer:

    {"name": "weather", "description": "Provides weather forecast", "inputs": {"city": "string", "date": "string"}, "outputs": {"temperature": "number", "conditions": "string"}} -> Option B
  4. Quick Check:

    Complete schema with inputs and outputs = {"name": "weather", "description": "Provides weather forecast", "inputs": {"city": "string", "date": "string"}, "outputs": {"temperature": "number", "conditions": "string"}} [OK]
Hint: Include inputs and outputs with correct types [OK]
Common Mistakes:
  • Omitting outputs section
  • Using wrong input/output keys or types
  • Leaving out description