> ADVANCED MCP PRESENTATION
SLIDE 07/16

> PROMPT TEMPLATES [REUSABLE CONVERSATIONS]

▶ STRUCTURED CONVERSATION PATTERNS

Reusable structured conversations that separate prompt content from tool logic
{
  "name": "resource_prompt",
  "description": "Analyze resource content with dynamic arguments",
  "arguments": [
    {
      "name": "resource_uri",
      "description": "URI of the resource to analyze",
      "required": true
    }
  ]
}

▶ DYNAMIC ARGUMENT SYSTEM

🔗 RESOURCE INTEGRATION

Load resources dynamically into prompts

🎯 PARAMETERIZED TEMPLATES

Customize prompts with runtime arguments

💾 EXTERNAL STORAGE

Store in config files or external systems

▶ PROMPT TEMPLATE ARCHITECTURE

┌──────────────────────────────────────────────────────────────┐
│                   PROMPT TEMPLATE SYSTEM                    │
├──────────────────────────────────────────────────────────────┤
│                                                              │
│  ┌─────────────┐    Arguments    ┌─────────────┐            │
│  │  TEMPLATE   │◄───────────────►│ DYNAMIC     │            │
│  │ resource_   │                 │ RESOURCE    │            │
│  │ prompt      │                 │ LOADER      │            │
│  └─────────────┘                 └─────────────┘            │
│         │                               │                   │
│         ▼                               ▼                   │
│  ┌─────────────┐                ┌─────────────┐            │
│  │ RENDERED    │◄───────────────┤ RESOURCE    │            │
│  │ CONVERSATION│                │ CONTENT     │            │
│  └─────────────┘                └─────────────┘            │
│                                                              │
│  Final prompt sent to model with injected resource data     │
└──────────────────────────────────────────────────────────────┘

🎮 LIVE DEMO: RESOURCE_PROMPT TEMPLATE

DEMONSTRATION: resource_prompt uses dynamic argument to load a resource
$ mcp-inspector
> Navigate to Prompts tab
> Select "resource_prompt" template
> Set resource_uri: "test://static/resource/42"

[TEMPLATE] Loading resource_prompt template
[ARGUMENT] resource_uri = "test://static/resource/42"
[LOADING] Fetching resource content...
[INJECTED] Resource data merged into prompt template

Generated Conversation:
┌─────────────────────────────────────────────┐
│ System: Analyze the following resource data │
│                                             │
│ Resource URI: test://static/resource/42     │
│ Content: {"id": 42, "timestamp": "...", ... │
│                                             │
│ User: Please summarize the key information  │
│ and identify any patterns or anomalies.     │
└─────────────────────────────────────────────┘

Key Observations:

  • Dynamic content injection - resource loaded at runtime
  • Template reusability - same template, different resources
  • Argument validation - required parameters enforced
  • Content flexibility - works with any resource type

▶ SEPARATION OF CONCERNS

├── PROMPT LOGIC     │ Template structure and flow
├── CONTENT SOURCE   │ Dynamic resource loading
├── PARAMETERIZATION │ Runtime argument injection
└── REUSABILITY      │ Multiple contexts, same template

▶ STORAGE OPTIONS

📁 CONFIG FILES

JSON/YAML template definitions

🗃️ EXTERNAL SYSTEMS

Database or CMS-managed templates

🔄 VERSION CONTROL

Git-tracked template evolution