I'm following the official Microsoft articleModel Context Protocol bindings for Azure Functions overview to make MCP-callable a function of my Azure function app, which works well through input and output queues: if I add a message into the input queue, it's correctly processed and returned into the output queue.
So I followed that article but it seems that the input variable is not filled by the VSCODE Copilot Studio agent, which uses other MCP tools normally and where my local tool looks correct.
Before digging into more details I want to understand why it is NOT possible to add the JSON snipped reported in the article
{
"version": "2.0",
"extensions": {
"mcp": {
"instructions": "Some test instructions on how to use the server",
"serverName": "TestServer",
"serverVersion": "2.0.0"
}
}
}
into my host.json file, which actually returns the warning "Property mcp is not allowed"
Here is my .csproj configuration:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.23.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.ApplicationInsights" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http.AspNetCore" Version="2.0.1" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Mcp" Version="1.0.0-preview.6" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Storage.Queues" Version="5.5.2" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="2.0.5" />
</ItemGroup>
</Project>
Now coming to the specific error, it seems that the input variable "Location" is not captured: as you see, rather than "Paris" it's empty
Of course, program.cs does contain "EnableMcpToolMetadata":
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
var builder = FunctionsApplication.CreateBuilder(args);
builder.EnableMcpToolMetadata();
builder.ConfigureFunctionsWebApplication();
builder.Services
.AddApplicationInsightsTelemetryWorkerService()
.ConfigureFunctionsApplicationInsights();
builder.Build().Run();
, while the function looks properly decorated:
[Function(nameof(get_weather_azure_function01_mcp))]
public void Run(
[McpToolTrigger("get_weather", "Gets the weather for a specific location.")] ToolInvocationContext context,
[McpToolProperty("Location", "string", "The location to check the weather for.")] string Location
)
So, the only missing configuration is the "mcp" section of host.json, but I'm also not 100% since as you saw in the picture, the function is correctly invoked, and the tool is configured in Copilot Studio:
The warning you're seeing is expected in the current state as the official host.json
schema hasn't been updated to include the preview extension configuration. This is safe to ignore and won't have any impact on the runtime behavior of the extension.
The property issue is the more impactful one and it's due to a bug with the service registration order. We're tracking to have that fixed in the next release, but for now, simply move the EnableMcpToolMetadata()
call below the ConfigureFunctionsWebApplication()
. This requirement will be fixed prior to this reaching GA.