Prompts
Prompts in MCP are reusable templates for structured interactions between AI models and servers. They provide predefined interaction patterns with parameters, enabling consistent and efficient communication for common use cases.What are Prompts?
Prompts are interaction templates with:- User-controlled invocation requiring explicit activation
- Parameter definitions for customizable inputs
- Structured formats for consistent interactions
- Context-aware content that can adapt to different scenarios
- Task planning templates (“Plan a vacation”)
- Code review workflows (“Review this pull request”)
- Content generation patterns (“Write a blog post about…”)
- Analysis frameworks (“Analyze market trends for…”)
- Decision support templates (“Compare options for…”)
Characteristics of Prompts
User Control
Prompts are never invoked automatically - they require explicit user activation, ensuring transparency and control over AI interactions.Parameter Support
Prompts can accept parameters to customize their behavior and adapt to specific contexts.Reusability
Well-designed prompts can be reused across different contexts and conversations.Listing Available Prompts
To see what prompts are available from a connected MCP server:Automatic Prompt List Update
When servers sendPromptListChangedNotification
, it signals that the prompt list has changed. The list_prompts()
method always fetches fresh data from the server, ensuring you get up-to-date information.
Important: Always use await session.list_prompts()
instead of the deprecated session.prompts
property to ensure you get fresh data:
Getting and Using Prompts
Prompts are retrieved using theget_prompt
method: