![]() |
VOOZH | about |
dotnet add package AzureFunctions.TestFramework.Mcp --version 0.14.0
NuGet\Install-Package AzureFunctions.TestFramework.Mcp -Version 0.14.0
<PackageReference Include="AzureFunctions.TestFramework.Mcp" Version="0.14.0" />
<PackageVersion Include="AzureFunctions.TestFramework.Mcp" Version="0.14.0" />Directory.Packages.props
<PackageReference Include="AzureFunctions.TestFramework.Mcp" />Project file
paket add AzureFunctions.TestFramework.Mcp --version 0.14.0
#r "nuget: AzureFunctions.TestFramework.Mcp, 0.14.0"
#:package AzureFunctions.TestFramework.Mcp@0.14.0
#addin nuget:?package=AzureFunctions.TestFramework.Mcp&version=0.14.0Install as a Cake Addin
#tool nuget:?package=AzureFunctions.TestFramework.Mcp&version=0.14.0Install as a Cake Tool
MCP (Model Context Protocol) trigger invocation support for the Azure Functions Test Framework. Provides InvokeMcpToolAsync(...), InvokeMcpResourceAsync(...), and InvokeMcpPromptAsync(...) — extensions on IFunctionsTestHost that let you trigger MCP-triggered functions directly from integration tests.
using AzureFunctions.TestFramework.Core;
using AzureFunctions.TestFramework.Mcp;
[Fact]
public async Task McpTool_WithArguments_Succeeds()
{
var result = await _testHost.InvokeMcpToolAsync(
"MyTool",
toolArguments: new Dictionary<string, object> { ["input"] = "hello" });
Assert.True(result.Success);
}
[Fact]
public async Task McpResource_WithUri_Succeeds()
{
var result = await _testHost.InvokeMcpResourceAsync(
"MyResource",
resourceUri: "resource://my-resource/item-1");
Assert.True(result.Success);
}
[Fact]
public async Task McpPrompt_WithArguments_Succeeds()
{
var result = await _testHost.InvokeMcpPromptAsync(
"MyPrompt",
arguments: new Dictionary<string, string> { ["topic"] = "testing" });
Assert.True(result.Success);
}
// McpToolTrigger
Task<FunctionInvocationResult> InvokeMcpToolAsync(
this IFunctionsTestHost host,
string functionName,
IReadOnlyDictionary<string, object>? toolArguments = null,
string? toolName = null,
string? sessionId = null,
CancellationToken cancellationToken = default)
// McpResourceTrigger
Task<FunctionInvocationResult> InvokeMcpResourceAsync(
this IFunctionsTestHost host,
string functionName,
string resourceUri,
string? sessionId = null,
CancellationToken cancellationToken = default)
// McpPromptTrigger
Task<FunctionInvocationResult> InvokeMcpPromptAsync(
this IFunctionsTestHost host,
string functionName,
IReadOnlyDictionary<string, string>? arguments = null,
string? promptName = null,
string? sessionId = null,
CancellationToken cancellationToken = default)
functionName — the name of the MCP function (case-insensitive).toolArguments / arguments — optional named arguments to pass to the tool or prompt.resourceUri — the URI of the MCP resource to trigger.toolName / promptName — optional name override; defaults to functionName when null.sessionId — optional MCP session ID; a new GUID is generated when null.Use FunctionInvocationResult to inspect output bindings produced by the function:
var result = await _testHost.InvokeMcpToolAsync("MyTool",
toolArguments: new Dictionary<string, object> { ["input"] = "hello" });
Assert.True(result.Success);
// Read the function return value
var returnValue = result.ReadReturnValueAs<string>();
Assert.Equal("expected output", returnValue);
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.