Skip to content

feat: mcp prompt trigger#330

Merged
hallvictoria merged 6 commits intodevfrom
hallvictoria/mcp-prompts
Apr 16, 2026
Merged

feat: mcp prompt trigger#330
hallvictoria merged 6 commits intodevfrom
hallvictoria/mcp-prompts

Conversation

@hallvictoria
Copy link
Copy Markdown
Contributor

@hallvictoria hallvictoria commented Apr 14, 2026

Fixes Azure/azure-functions-python-worker#1846

Examples:

@app.mcp_prompt_trigger(
    arg_name="context",
    prompt_name="code_review",
    prompt_arguments=[
        func.PromptArgument("code", "The code to review", required=True),
        func.PromptArgument("language", "The programming language", required=False)
    ],
    title="Code Review",
    description="Generates a code review prompt for the given code snippet"
)
def code_review_prompt(context: func.PromptInvocationContext) -> str:
    # Access arguments from context
    code = context.arguments.get("code", "// no code provided")
    language = context.arguments.get("language", "unknown")
    
    return f"Please review the following {language} code and suggest improvements:\n\n```{language}\n{code}\n```"


# Example 2: Simple prompt with single required argument
@app.mcp_prompt_trigger(
    arg_name="context",
    prompt_name="summarize",
    prompt_arguments=[
        func.PromptArgument("text", "The text to summarize", required=True)
    ],
    title="Summarize Text",
    description="Summarizes the provided text"
)
def summarize_prompt(context: func.PromptInvocationContext) -> str:
    text = context.arguments.get("text", "No text provided")
    return f"Please provide a concise summary of the following text:\n\n{text}"


# Example 3: Prompt with no arguments
@app.mcp_prompt_trigger(
    arg_name="context",
    prompt_name="greeting",
    title="Greeting Prompt",
    description="A simple greeting prompt"
)
def greeting_prompt(context: func.PromptInvocationContext) -> str:
    return "Hello! How can I assist you today?"

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

@hallvictoria hallvictoria marked this pull request as ready for review April 15, 2026 14:58
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
Successfully started running 1 pipeline(s).

Comment thread azure/functions/decorators/mcp.py
@hallvictoria hallvictoria enabled auto-merge (squash) April 16, 2026 15:46
@hallvictoria hallvictoria merged commit 04f2cbc into dev Apr 16, 2026
16 checks passed
@hallvictoria hallvictoria deleted the hallvictoria/mcp-prompts branch April 16, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MCP Prompt] Implement support for MCP prompts

2 participants