liveBook · Manning

Schema

As explained in AI Agents in Action, Second Edition

A data schema is a formal specification of the structure, fields, types, relationships, and constraints of data.

A schema makes expectations about data explicit. In agent workflows, typed input/output schemas avoid brittle string parsing. For MCP tools, the function signature defines parameters, the docstring describes when to call the tool, and return annotations indicate the expected result shape. section 2.6 section 3.2.1

Listing 3.1 01_claude_mcp_server.py
from mcp.server.fastmcp import FastMCP

# Create an MCP server
mcp = FastMCP("Research Tools")    #1

@mcp.tool()    #2
def get_research_sources() -> list[str]:
    """Provides a list of research sources."""
    search_sources = [
        "Wikipedia",
        "Google",
        "YouTube",
    ]
    return search_sources 

This minimal Python MCP server shows a tool whose return annotation and docstring contribute to its schema. section 3.2.1

How AI Agents in Action, Second Edition covers it

How deep it goes
Maps MCP function signatures, docstrings, and return annotations to tool parameters, descriptions, and expected result shapes.
Examples
Uses a Python `get_research_sources` tool returning a list of strings, alongside typed input/output schemas built with Pydantic.
What you can do after
Apply it via Pydantic types and the MCP `@mcp.tool()` decorator to structure agent data and expose a function's callable interface.
How it connects
Connects schemas to Pydantic, multi-agent workflows, the Model Context Protocol (MCP), and callable agent tools.

Also explained in

Compare how 44 books explain schema →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents in Action, Second Edition. The section links point to the parts of the book it draws on.