AI Hints
Home›MCP Tutorial›Discovery and stdio
MCP · Lesson 10 of 120

What the Client Sees

The tool schema.

⏱ 2 min read▶ Video at 8:06🎓 Free
Watch this lesson in the MCP courseWatch on YouTube ↗Full MCP course

A model can't read your Python code. It only sees what the server describes. Each tool's name, its description, and a JSON schema of its inputs. That's how the model knows when and how to call it.

What the Client Sees
From the video: What the Client Sees
  • Models can't see code
  • Name and description
  • Input schema

Listing the tools

List tools asks the server what tools it has. For each one, we print the name, the description, and the input schema. Run it. The type hint float became a number, and the argument is required.

list_tools.pypython
import asyncio
from mcp import Client
from northwind import mcp

async def main():
    async with Client(mcp) as client:
        result = await client.list_tools()
        for tool in result.tools:
            print(tool.name, "|", tool.description)
            print("   ", tool.input_schema["properties"], tool.input_schema["required"])

asyncio.run(main())
Output
order_status | Look up the status of a Northwind order by its number.
    {'order_id': {'title': 'Order Id', 'type': 'integer'}} ['order_id']
delivery_cost | UK delivery cost for an order total in pounds.
    {'order_total': {'title': 'Order Total', 'type': 'number'}} ['order_total']
Also uses northwind.py
from mcp.server.mcpserver import MCPServer
from mcp.server.mcpserver.exceptions import ToolError

mcp = MCPServer("northwind")
ORDERS = {1042: "shipped", 1043: "packing", 1044: "delivered"}

@mcp.tool()
def order_status(order_id: int) -> str:
    """Look up the status of a Northwind order by its number."""
    if order_id not in ORDERS:
        raise ToolError(f"Order {order_id} not found")
    return ORDERS[order_id]

@mcp.tool()
def delivery_cost(order_total: float) -> str:
    """UK delivery cost for an order total in pounds."""
    return "free" if order_total >= 50 else "£4.99"

@mcp.resource("policy://returns")
def returns_policy() -> str:
    """Northwind's returns policy."""
    return "You can return any unused item within 30 days of delivery."

@mcp.prompt()
def support_reply(question: str) -> str:
    """Draft a polite reply to a customer."""
    return f"Write a short, polite reply to this Northwind customer: {question}"

if __name__ == "__main__":
    mcp.run()
Also uses sitecustomize.py
import logging, warnings
logging.disable(logging.INFO)
warnings.filterwarnings("ignore")

Why it matters

The description is how the model decides to use a tool. The schema is how it builds the arguments. Clear names, clear descriptions, and precise types make the model far more reliable.

keyvalue
Descriptionwhen to use it
Schemahow to call it
Clear namesfewer mistakes
Precise typesvalid arguments

Summary

Clients discover tools through their names, descriptions, and input schemas. Next, running the server as a real program.

Key takeaways
  • list_tools
  • description
  • input_schema
Next up: Running over stdio — a real subprocess