Lesson 07.04 · Phase 07 · Model Context Protocol
Tools, resources & prompts
A server offers three kinds of thing, and the difference is who decides when they're used. The model calls tools. The application attaches resources. The user picks prompts. Put a capability in the wrong bucket and either the model can't reach it or it reaches things it shouldn't.
Learning objectives
- Implement resources (resources/list, resources/read, resources/templates/list) with text and binary contents and URI templates.
- Serve files from a folder through a resource template without path traversal, including encoded .. and symlinks.
- Implement prompts (prompts/list, prompts/get) with required and optional arguments, embedding resources in the messages.
- Link tools to resources with resourcelink results, and cache list and read results by ttlMs.
Lesson 3's server had only tools. Everything a model could get from it, it had to ask for with a tool call. That's wrong for two kinds of content:
Loading the full lesson…