MCP Academy · Lesson

Declare Parameters with Type Hints

Use Python hints to shape the tool schema.

Parameters Become a Schema

Every argument of your tool function turns into part of an input schema the model must follow when it calls your tool. 🧩

Type Hints Do the Work

FastMCP reads your Python type hints and builds the JSON schema for you, so you rarely write schema by hand.

@mcp.tool()
def add(a: int, b: int) -> int:
    return a + b

All lessons in this course

  1. Name & Describe a Tool Well
  2. Declare Parameters with Type Hints
  3. Return Useful Results
  4. A Calculator Tool, Start to Finish
← Back to MCP Academy