Skip to content

New data structure examples#17

Closed
ivanvaccarics wants to merge 0 commit intoAzure-Samples:mainfrom
ivanvaccarics:main
Closed

New data structure examples#17
ivanvaccarics wants to merge 0 commit intoAzure-Samples:mainfrom
ivanvaccarics:main

Conversation

@ivanvaccarics
Copy link

@ivanvaccarics ivanvaccarics commented Jul 8, 2025

Purpose

  • This update adds new functionalities for the MCP server and a section to the README that clearly explains all MCP tool functions available in the Azure Functions MCP server, including snippet management and IoT sensor data tools. It improves documentation for users and developers, making it easier to understand and use the available endpoints.

Does this introduce a breaking change?

[ ] Yes
[x] No

Pull Request Type

What kind of change does this Pull Request introduce?

[ ] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[x] Documentation content changes
[ ] Other... Please describe:

How to Test

  • Get the code
git clone [repo-address]
cd [repo-name]
git checkout [branch-name]
# (No npm install needed for Python project, but keep if repo has JS tools)
  • Test the code
# Open README.md and verify the new "MCP Tool Functions Overview" section is present after the extensionBundle note.
# Confirm that all function descriptions and usage examples are clear and accurate.

What to Check

Verify that the following are valid

  • The README contains a new section "MCP Tool Functions Overview" after the extensionBundle note.
  • All MCP server functions (hello_mcp, get_snippet, save_snippet, save_simple_sensor_data, save_complex_sensor_data) are described with purpose and usage examples.
  • No existing documentation or code is broken by this change.

Other Information

  • This documentation update helps new users and contributors quickly understand the available MCP tools and how to use them in local or

@lilyjma
Copy link
Collaborator

lilyjma commented Mar 18, 2026

@swapnil-nagar / @hallvictoria - could you take a look at this PR please? It's a contribution addressing this issue: #15

@hallvictoria
Copy link
Contributor

Our decorator structure has changed since this PR & is no longer using generic bindings or the complicated ToolProperty formatting. The hello_mcp function shows simple usage, and get_snippet shows more complex usage with the @app.mcp_tool_property decorator.

For the simple example, here's how it would look using mcp_tool_property - this is the exact same experience as what's currently in this PR:

@app.mcp_tool()
@app.mcp_tool_property(arg_name="sensor_id", description="ID of the sensor")
@app.mcp_tool_property(arg_name="metric_name", description="Name of the metric")
@app.mcp_tool_property(arg_name="value", description="Value of the metric")
@app.mcp_tool_property(arg_name="unit", description="Unit of the metric")
@app.mcp_tool_property(arg_name="timestamp", description="Timestamp of the data")
@app.mcp_tool_property(arg_name="IsCalibrated", description="If the device is calibrated manually (true) or automatically (false)")
@app.blob_output(arg_name="file", connection="AzureWebJobsStorage", path=_SIMPLE_SENSOR_BLOB_PATH)
def save_simple_sensor_data(
    file: func.Out[str], 
    sensor_id: str, 
    metric_name: str, 
    value: float, 
    unit: str, 
    timestamp: str,
    IsCalibrated: bool
) -> str:
    ...

Alternatively, if an individual description for each property isn't needed, you can write the function like this:

@app.mcp_tool()
@app.blob_output(arg_name="file", connection="AzureWebJobsStorage", path=_SIMPLE_SENSOR_BLOB_PATH)
def save_simple_sensor_data(
    file: func.Out[str], 
    sensor_id: str, 
    metric_name: str, 
    value: float, 
    unit: str, 
    timestamp: str,
    IsCalibrated: bool
) -> str:
    """
    Save sensor data to Azure Blob Storage.

    Args:
        file (func.Out[str]): The output binding to write the sensor data to Azure Blob Storage.
        sensor_id (str): ID of the sensor.
        metric_name (str): Name of the metric.
        value (float): Value of the metric.
        unit (str): Unit of the metric.
        timestamp (str): Timestamp of the data.
        IsCalibrated (bool): If the device is calibrated manually (true) or automatically (false).

    Returns:
        str: A success message indicating that the sensor data was saved.
    """
   ...

We can add these changes to the sample if there's still confusion / interest in showing more examples. Let me know if there are any questions or comments!

@ivanvaccarics
Copy link
Author

Hi @hallvictoria thanks for the update. I pushed this PR long time ago. If you need more examples, i can contribute with a PR with the new standard. Let me know, thanks!

@hallvictoria
Copy link
Contributor

@ivanvaccarics, sure, please feel free to add any more examples. Let me know if there are any issues or confusion using the new standard!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants