#Agents#Function Calling#Pydantic#MCP#Structured Output#Tool Use#Syllabus

Module 20: Agent Basics — Function Calling and MCP

Syllabus on agent foundations — validating and structuring outputs with Pydantic, cross-provider function calling, building tool executor loops, and standardising tool integration with the Model Context Protocol (MCP).

May 28, 2026 at 12:06 PM2 min readFollowFollow (Hindi)

Topics You Will Master

Data validation and structured outputs with Pydantic
Function-calling fundamentals: schema design and the request-response lifecycle
Parallel calls, constrained tool choice, and structured output vs function calling
Building a tool executor loop and cross-provider support (OpenAI, Anthropic, Google)
The Model Context Protocol (MCP): architecture, primitives, transport, and security
Best For

Engineers building the tool-use layer that turns an LLM into an agent.

Expected Outcome

The ability to design validated tool interfaces, run cross-provider function calling, and standardise tools through MCP.

Module Overview

This module covers the foundations of agentic systems: reliably structuring and validating model outputs, the mechanics of function calling across providers, and the Model Context Protocol that standardises how tools are exposed to and consumed by agents.

Learning Objectives

  • Validate and structure agent outputs with Pydantic.
  • Design function schemas and explain the request-response lifecycle.
  • Use parallel calls and constrained tool choice, and contrast structured output with function calling.
  • Build a provider-agnostic tool executor loop.
  • Explain MCP architecture, primitives, transport, and trust boundaries.

Topics Covered

Pydantic — Data Validation & Structured Outputs

  • Installation, models, fields, validators
  • JSON parsing and type coercion
  • Dataclasses and nested models
  • Validation decorators and custom validators
  • Settings management

Function Calling Fundamentals

  • Why function calling exists — the LLM-to-tool communication problem
  • Function schema design — JSON Schema, descriptions, parameter typing
  • The function-calling request-response lifecycle

Parallel Calls, Constrained Choice & Structured Output

  • Parallel function calling — multiple tool calls in one response
  • Forced and constrained tool choice — required, none, and specific tool selection
  • Structured output vs function calling — differences and when to use each

Tool Executor Loop & Cross-Provider Support

  • Building a tool executor loop from scratch
  • Function calling across providers — OpenAI, Anthropic, Google — and the universal contract

MCP (Model Context Protocol)

  • Why MCP exists — the tool fragmentation problem
  • MCP architecture — hosts, clients, and servers
  • MCP primitives — tools, resources, and prompts
  • MCP transport layer — stdio and SSE
  • Building an MCP server and client
  • MCP security — authentication, authorization, and trust boundaries
  • MCP in production — multi-server orchestration

Key Concepts & Terminology

Schema-constrained generation, type coercion, tool executor loop, universal tool contract, MCP host/client/server, stdio vs SSE transport, trust boundary.

Tools & Frameworks Referenced

Pydantic, OpenAI/Anthropic/Google function-calling APIs, Model Context Protocol (MCP), FastMCP.

Prerequisites

Module 15 (LangChain) helps; general LLM application experience.

Find this tutorial useful?

Subscribe to our YouTube channels for more practical production walk-throughs.

Discussion & Comments