← Lessons

quiz vs the machine

Gold1360

Machine Learning

Function Schema Design

Writing tool definitions a model can call correctly.

5 min read · core · beat Gold to climb

The schema is the prompt

A tool's schema is part of the prompt. The model only knows what the name, description, and parameter docs tell it. A vague schema produces wrong arguments, so schema design is real prompt engineering.

Principles

  • Clear names use verbs that say what the tool does, like search orders
  • Tight descriptions state when to use the tool and when not to
  • Typed parameters declare types, enums, and which fields are required
  • Few parameters fewer arguments means fewer ways to get it wrong

How the model reads it

The model maps the user intent onto the description, then fills parameters from context. Missing constraints lead to guessed values.

Common mistakes

Overloading one tool with many modes confuses the model, prefer several focused tools. Free form string parameters invite invalid input, prefer enums. And never assume the model knows units or formats, state them in the description.

Key idea

A tool schema teaches the model how and when to call a function, so clear names, tight descriptions, and tightly typed parameters are what make calls reliable.

Check yourself

Answer to earn rating on the learn ladder.

1. Why is a function schema considered part of the prompt?

2. Which practice improves tool call reliability?