Two small tools are enough to teach the pattern

Outcome

Advanced users see how plain Python functions become discoverable MCP tools.

Python function

Type hints

Docstring

FastMCP decorator

Inspectable tool

ImportantCore lesson

The important transformation is not complexity. It is structure.

Minimal example

from mcp.server.fastmcp import FastMCP

mcp = FastMCP("demo")

@mcp.tool()
def ping(name: str) -> str:
    """Return a simple greeting."""
    return f"Hello, {name}!"

Canonical walkthrough shape

  • one lookup-style tool
  • one data or status tool
  • short descriptions with good parameter names
  • a run path that works locally before deployment
NoteTeaching prompt

Ask the room which parts are business logic and which parts are protocol glue.

Back to top