Implement MCP task support (SEP-1686) (#1170)

Co-authored-by: Stephen Halter <halter73@gmail.com>
This commit is contained in:
Eirik Tsarpalis 2026-01-28 05:21:02 +02:00 • committed by GitHub
commit 10e4f5b20f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,7 @@
using Microsoft.Extensions.AI;
using ModelContextProtocol.Protocol;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json;
using System.Text.Json.Nodes;
@ -176,6 +177,23 @@ public sealed class McpServerToolCreateOptions
/// </remarks>
public JsonObject? Meta { get; set; }
/// <summary>
/// Gets or sets the execution hints for this tool.
/// </summary>
/// <remarks>
/// <para>
/// Execution hints provide information about how the tool should be invoked, including
/// task support level (<see cref="ToolTaskSupport"/>).
/// </para>
/// <para>
/// If <see langword="null"/>, the tool's execution settings are determined automatically based on
/// the method signature (async methods get <see cref="ToolTaskSupport.Optional"/>; sync methods
/// get <see cref="ToolTaskSupport.Forbidden"/>).
/// </para>
/// </remarks>
[Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)]
public ToolExecution? Execution { get; set; }
/// <summary>
/// Creates a shallow clone of the current <see cref="McpServerToolCreateOptions"/> instance.
/// </summary>
@ -196,5 +214,6 @@ public sealed class McpServerToolCreateOptions
Metadata = Metadata,
Icons = Icons,
Meta = Meta,
Execution = Execution,
};
}