Skip to content

Conversation

@hallvictoria
Copy link
Contributor

@hallvictoria hallvictoria commented Oct 16, 2025

Simplifies the mcp_tool_trigger decorator.

Customers can define MCP tools by adding the mcp_tool decorator - the arguments and tool properties are inferred based on the method definition.

@app.mcp_tool()
@app.blob_output(arg_name="file", connection="AzureWebJobsStorage", path=_BLOB_PATH)
def save_snippet(file: func.Out[str],
                 snippetname: str,
                 snippet: Optional[List[int]] = None) -> str:
    """Save a snippet to Azure Blob Storage."""
    file.set(snippet)
    logging.info(f"Saved snippet: {snippetname}")
    return f"Snippet '{snippetname}' saved successfully with content: {snippet}"

Alternatively, customers have the option to specify each tool property by using the mcp_tool_property decorator.

@app.mcp_tool()
@app.mcp_tool_property(arg_name="snippetname", description="The name of the snippet.")
@app.blob_output(arg_name="file", connection="AzureWebJobsStorage", path=_BLOB_PATH)
def save_snippet(file: func.Out[str],
                 snippetname: str,
                 snippet: Optional[List[int]] = None) -> str:
    """Save a snippet to Azure Blob Storage."""
    file.set(snippet)
    logging.info(f"Saved snippet: {snippetname}")
    return f"Snippet '{snippetname}' saved successfully with content: {snippet}"

@hallvictoria hallvictoria marked this pull request as ready for review November 6, 2025 20:07
@hallvictoria hallvictoria requested a review from vrdmr as a code owner November 6, 2025 20:07
@hallvictoria hallvictoria merged commit dea2ff1 into dev Nov 6, 2025
15 checks passed
@hallvictoria hallvictoria deleted the hallvictoria/simplified-mcp-decorator branch November 6, 2025 21:09
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.

4 participants