We are thrilled to announce that the MCP prompt trigger is now available in public preview in the Azure Functions MCP extension! With this release, the extension now supports all three core MCP server primitives - tools, resources, and prompts, giving you a complete platform for building rich MCP servers on Azure Functions.
In case you missed it, the MCP resource trigger is generally available for serving resources and building interactive UIs in MCP Apps.
What are MCP Prompts
In the Model Context Protocol (MCP), prompts are reusable templates that allow server authors to provide parameterized prompts for a domain, or showcase how to best use the MCP server. Prompts are user-controlled in that they require explicit invocation rather than automatic triggering, and can be context-aware, referencing available resources and tools to create comprehensive workflows.
Unlike tools (which are model-controlled) and resources (which are application-controlled), prompts are exposed from servers to clients so users can explicitly select them. Applications typically expose prompts through slash commands, command palettes, dedicated UI buttons, or context menus.
How It Works
In Python, defining a prompt is as simple as decorating a function. Here's a prompt that returns a code review checklist:
app.mcp_prompt_trigger(
arg_name="context",
prompt_name="code_review_checklist",
description="Returns a structured code review checklist prompt for evaluating code changes."
)
def code_review_checklist(context: func.PromptInvocationContext) -> str:
logging.info("Code review checklist prompt invoked.")
return """You are a senior software engineer performing a code review.
Use the following checklist to evaluate the code:
1. **Correctness** — Does the code do what it's supposed to?
2. **Error Handling** — Are edge cases and failures handled?
3. **Security** — Are there any vulnerabilities (injection, auth, secrets)?
4. **Performance** — Are there obvious inefficiencies?
5. **Readability** — Is the code clear and well-named?
6. **Tests** — Are there adequate tests for the changes?
Provide your feedback in a structured format with a severity level
(critical, warning, suggestion) for each finding."""
Prompts can accept arguments, allowing clients to customize the generated message. Here's a prompt that generates documentation with configurable parameters:
app.mcp_prompt_trigger(
arg_name="context",
prompt_name="generate_documentation",
prompt_arguments=[
func.PromptArgument("function_name", "The name of the function to document.", required=False),
func.PromptArgument("style", "Documentation style: 'concise', 'detailed', or 'tutorial'.", required=False)
],
description="Generates API documentation for a function. Arguments are configured in Program.cs."
)
def generate_documentation(context: func.PromptInvocationContext) -> str:
function_name = context.arguments.get("function_name", "(unknown)")
style = context.arguments.get("style", "concise")
logging.info(f"Generate docs prompt invoked for function: {function_name}")
return f"""Generate API documentation for the function named **{function_name}**.
Documentation style: **{style}**
Include the following sections:
- **Description** — What the function does.
- **Parameters** — List each parameter with its type and purpose.
- **Return Value** — What the function returns.
- **Example Usage** — A short code example showing how to call it."""
Checkout the Get Started section for the complete sample and samples in different languages.
Why Azure Functions
Azure Functions is the ideal platform for hosting remote MCP servers because of its built-in MCP authentication, event-driven scaling from 0 to N, and serverless billing. This ensures your agentic tools are secure, cost-effective, and ready to handle any load. With the MCP extension, you focus on implementing the primitives you want to expose, tools, resources, and prompts, instead of worrying about MCP protocol details and server logistics.
Get Started
You can start building today using our quickstarts and samples:
Documentation
We'd Love to Hear from You!
Let us know your thoughts about the new prompt trigger. What kinds of prompts are you building for your MCP servers? What would you like us to prioritize next? Share your feedback in our GitHub repo.