0Pricing
AI Prompt Engineering · Lesson

Tool/Function Schemas

Schemas for function calling.

Tools Are Schemas Plus Intent

Function calling lets a model request that your code execute an action. Each tool is declared with a name, a description (when to use it), and a JSON Schema for its parameters.

The model never runs code; it emits a structured call request that your runtime dispatches. The schema is what makes the arguments parseable.

Anatomy of a Tool Definition

A tool definition is a schema-wrapped capability declaration.

{
  'type': 'function',
  'function': {
    'name': 'get_weather',
    'description': 'Get current weather for a city. Use when the user asks about weather.',
    'parameters': {
      'type': 'object',
      'properties': {
        'city': {'type': 'string'},
        'units': {'type': 'string', 'enum': ['celsius', 'fahrenheit']}
      },
      'required': ['city', 'units'],
      'additionalProperties': False
    }
  }
}

All lessons in this course

  1. Why Structured Output
  2. JSON Schema in Prompts
  3. Tool/Function Schemas
  4. Repair and Validation Loops
← Back to AI Prompt Engineering