Skip to main content
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
Common examples include:
  • 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 send PromptListChangedNotification, 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 the get_prompt method:

Prompt Without Arguments

Some prompts don’t require parameters:

Prompt Structure

Prompts return structured content with messages:

Parameter Completion

Many prompts support parameter completion to help users understand required inputs:

Dynamic Prompt Generation

Some prompts can generate different content based on context:

Error Handling

Handle potential errors when working with prompts: