Getting Started with Model Context Protocol (MCP) (eBook)
200 Seiten
Publishdrive (Verlag)
978-0-00-091653-2 (ISBN)
Getting Started with Model Context Protocol (MCP): A Beginner's Guide to Building Structured AI Agent Systems
Modern software systems are shifting rapidly from prompt-based experiments to structured, protocol-driven agent architectures. If you're looking to build intelligent applications that are clear, maintainable, and scalable, this guide to Model Context Protocol (MCP) is the perfect starting point.
Build Smarter Agent Systems from the Ground Up
This practical guide introduces the essential concepts behind MCP - a framework designed to help developers build role-based, tool-integrated, and context-aware agent workflows. Whether you're designing your first autonomous system or refining an existing setup, you'll find step-by-step explanations, schema templates, and workflow patterns that bring clarity to complex development tasks.
What This Book Covers
Clear explanations of core MCP roles: Planner, Retriever, Executor, Validator, Critic
How to define tool manifests, memory structures, and execution contracts
How to structure agent workflows using YAML/JSON DSL formats
Integration techniques for tools, APIs, and shared memory resources
Common mistakes to avoid when building multi-step agent systems
Real-world implementation patterns in Python and other practical formats
A Resource for Engineers and Builders
This book is written for developers, engineers, and technical teams who want to create reliable and reusable agent systems. It provides foundational knowledge and field-tested methods that can be applied across many modern platforms.
Inside You'll Find
Dozens of example templates and configuration patterns
Full walk-throughs for building complete agent pipelines
A comprehensive glossary and troubleshooting guide
Appendices covering schema design, DSL rules, and evaluation practices
Guidance on future trends like autonomous runtimes and memory federation
If you're ready to move beyond trial-and-error prompt design and start building structured, dependable systems - this book gives you the foundation to do exactly that.
Build with clarity. Deploy with confidence. Start your journey with MCP today.
Chapter 2: The Evolution of Agent Architectures
2.1 From Prompts to Modular Agents
Introduction
The first wave of LLM applications was dominated by single-shot prompting and manually designed prompt chains. While these approaches made it easy to experiment, they lacked structure, testability, and composability. As tasks grew in complexity, developers began modularizing LLM interactions into agent components each with defined behavior, access, and responsibilities.
This shift—from prompt monoliths to modular agents—laid the groundwork for protocol-driven systems like MCP.
Concept Breakdown
Definition:
Modular Agent — A self-contained LLM-based component that operates within a system, responsible for a specific task or function, guided by context and tool access.
Definition:
Prompt Chaining — The ad-hoc practice of feeding LLM outputs into downstream prompts without role definition or context schema.
Table: Prompt Chaining vs. Modular Agent Systems
Feature
Prompt Chaining
Modular Agents (MCP-Aligned)
Execution Model
Sequential, implicit
Role-based, explicit
Reusability
Poor
High
Debuggability
Manual logs, unclear
Role logs, context schema
Testing Scope
Entire chain
Per-agent unit testing
Agent Role Separation
None
Strict
Flowchart: System Evolution
Prompt Chaining →
↓
Hardcoded Roles →
↓
Output Inconsistency →
↓
Modular Agent Systems (Planner → Executor → Critic) →
↓
Protocol Adoption (MCP)
Tip: Modular agents follow the principle of single responsibility — each agent should handle one function well and defer others.
Application Layer
Example: Building a Document Summary System
Version
Implementation
Prompt-Only
A single prompt: “Search the web and summarize the top result.”
Modular Agent
Role 1: Retriever → Role 2: Executor → Role 3: Critic
Retriever Context Example:
context:
role: "retriever"
goal: "Find recent research on AI reliability"
input: "latest AI reliability papers"
tools:
- name: "scholar_search"
Each component is replaceable, debuggable, and testable on its own.
Challenges & Pitfalls
Challenge
Description
Under-Modularization
Agents with overloaded responsibilities fail in multi-task settings
Poor Handoff Design
Improper output/input mapping between agents breaks workflows
Tool Assumptions
Agents may try to call tools not scoped to them
Lack of Memory Awareness
Agents unaware of past steps reduce system consistency
Dependency Entanglement
Without schema, tightly coupled logic causes downstream breakage
Key Takeaways
2.2 Function Calling and Tool-Augmented Execution
Introduction
The ability to call tools — such as APIs, scripts, or functions — is central to agent execution. LLMs like GPT-4, Claude, and open-source models now support function calling, which enables agents to act with real capabilities beyond language prediction.
Tool-augmented execution transforms agents from responders to actors — capable of retrieving data, making calculations, posting updates, and more.
Concept Breakdown
Definition:
Function Calling — A mechanism by which an LLM outputs a structured JSON object corresponding to an API schema, rather than plain text.
Definition:
Tool-Augmented Agent — An agent that can invoke predefined external tools, APIs, or utilities during execution, based on structured context.
Table: Function Calling Properties
Property
Description
Schema Validation
Inputs/outputs must match a declared interface
Execution Delegation
Model calls function; system executes it
Result Injection
Tool output is appended to the agent's context
Retry Capability
Tool can be re-invoked or replaced on failure
Tip: Always define tool input/output schemas. This improves interpretability and helps prevent runtime errors.
Application Layer
Let’s say your agent needs to calculate compound interest.
Tool Manifest:
{
"name": "calc_interest",
"description": "Calculate compound interest",
"input_schema": {
"principal": "float",
"rate": "float",
"time": "int"
},
"output_schema": {
"total": "float"
}
}
Context Example (Executor Role):
context:
role: "executor"
goal: "Calculate interest"
input: "principal=1000, rate=5%, time=2 years"
tools:
- name: "calc_interest"
LLM Output (Function Call Intent):
{
"tool_call": {
"name": "calc_interest",
"arguments": {
"principal": 1000,
"rate": 0.05,
"time": 2
}
}
}
The system runs the call, appends the result, and the agent proceeds with full tool feedback.
Challenges & Pitfalls
Challenge
Description
No Schema Enforcement
Functions used without strict definitions lead to unpredictable behavior
Tool Overuse
Relying on too many tools can slow system execution
API Failures
Retry logic must handle rate limits and tool outages
Output Injection Errors
Tool results not parsed or mapped correctly to next step
Permissions Leakage
Agents accessing unauthorized tools create security risk
Key Takeaways
2.3 The Emergence of Role-Based Design
Introduction
As developers pushed the boundaries of what LLMs could accomplish, they encountered a familiar software engineering truth: clarity and separation of responsibility are essential. The traditional practice of embedding logic into prompts failed to scale or generalize.
This led to the rise of role-based agent design, where each AI agent performs a clearly defined function — a model adopted and formalized in MCP.
Concept Breakdown
Definition:
Role-Based Design — A system architecture that assigns each AI agent a single, bounded responsibility (e.g., planning, retrieval, execution, validation), executed independently through structured context.
Definition:
Role Contract — A specification that outlines what an agent is supposed to do, the input schema it accepts, and the output it must...
Erscheint lt. Verlag | 21.6.2025 |
---|---|
Sprache | englisch |
Themenwelt | Informatik ► Theorie / Studium ► Künstliche Intelligenz / Robotik |
ISBN-10 | 0-00-091653-6 / 0000916536 |
ISBN-13 | 978-0-00-091653-2 / 9780000916532 |
Informationen gemäß Produktsicherheitsverordnung (GPSR) | |
Haben Sie eine Frage zum Produkt? |

Größe: 1,4 MB
Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM
Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belletristik und Sachbüchern. Der Fließtext wird dynamisch an die Display- und Schriftgröße angepasst. Auch für mobile Lesegeräte ist EPUB daher gut geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine
Geräteliste und zusätzliche Hinweise
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich