How It Works
Tools can send notifications through theContext object to inform clients about various events such as progress updates, list changes (tools, resources, prompts), or custom events.
Progress Notifications
Report progress during long-running operations:List Change Notifications
Notify clients when server capabilities change:All Notification Types
The context provides these notification methods:report_progress()- Send progress updates for long-running operationssend_tool_list_changed()- Notify when available tools changesend_resource_list_changed()- Notify when available resources changesend_prompt_list_changed()- Notify when available prompts change
Use Case Example
A data processing server that provides real-time feedback:Important Notes
- Notifications are fire-and-forget; they don’t return responses
- Clients should handle notifications asynchronously to avoid blocking
- Progress values should be between 0.0 and 1.0
- List change notifications prompt clients to refresh their cached lists
Next Steps
- See Logging for structured logging
- Learn about Sampling for requesting LLM completions
- Check the Context API for all available methods