> ADVANCED MCP PRESENTATION
SLIDE 05/16

> TOOLS: THE HEART OF MCP [CORE PRIMITIVE]

▶ TOOL DEFINITION STRUCTURE

Define name, title, description, and JSON schema for intelligent LLM selection
{
  "name": "longRunningOperation",
  "title": "Long Running Operation Demo",
  "description": "Demonstrates async streaming with progress notifications",
  "inputSchema": {
    "type": "object",
    "properties": {
      "duration": {"type": "number", "description": "Operation duration in seconds"},
      "steps": {"type": "number", "description": "Number of progress steps"}
    },
    "required": ["duration"]
  }
}

▶ DESIGN PATTERNS

🎯 FINE-GRAINED OVER MONOLITHS

Prefer focused, single-purpose tools

📝 DESCRIPTIVE METADATA

Help LLMs choose tools intelligently

⚡ ASYNC CAPABILITIES

Stream progress, handle long operations

▶ ASYNC STREAMING ARCHITECTURE

┌──────────────────────────────────────────────────────────────┐ │ LONGRUNNINGOPERATION TOOL │ ├──────────────────────────────────────────────────────────────┤ │ REQUEST STREAM UPDATES COMPLETION │ │ │ │ │ │ │ ▼ ▼ ▼ │ │ ┌─────┐ ┌─────────┐ ┌─────────┐ │ │ │START│────────────►│PROGRESS │────────────►│ RESULT │ │ │ └─────┘ │NOTIFS │ └─────────┘ │ │ └─────────┘ │ │ │ │ │ Real-time updates │ │ to client/inspector │ └──────────────────────────────────────────────────────────────┘

🎮 LIVE DEMO: LONGRUNNINGOPERATION

DEMONSTRATION: Everything Server's longRunningOperation tool - async streaming + notifications
$ mcp-inspector
> Call longRunningOperation(duration: 10, steps: 5)

[STREAM] Starting operation...
[PROGRESS] Step 1/5 (20%) - Processing data chunk 1
[PROGRESS] Step 2/5 (40%) - Processing data chunk 2
[PROGRESS] Step 3/5 (60%) - Processing data chunk 3
[PROGRESS] Step 4/5 (80%) - Processing data chunk 4
[PROGRESS] Step 5/5 (100%) - Operation complete
[RESULT] Final result with full metadata

Key Observations:

  • Real-time progress - streaming notifications
  • Cancellation support - can interrupt long operations
  • Error recovery - graceful handling of failures
  • Resource management - proper cleanup on completion

▶ INTELLIGENT TOOL SELECTION

LLM Decision Process: ├── Read tool descriptions ├── Match to user intent ├── Validate required parameters └── Execute with confidence