using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
namespace ModelContextProtocol.Protocol;
///
/// Represents execution-related metadata for a tool.
///
///
/// This type provides hints about how a tool should be executed, particularly
/// regarding task augmentation support.
///
[Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)]
public sealed class ToolExecution
{
///
/// Gets or sets the level of task augmentation support for this tool.
///
///
///
/// This property declares whether a tool supports task-augmented execution:
///
/// - : Clients must not attempt to invoke
/// the tool as a task. This is the default behavior.
/// - : Clients may invoke the tool as a task
/// or as a normal request.
/// - : Clients must invoke the tool as a task.
///
///
///
///
/// This is a fine-grained layer in addition to server capabilities. Even if a server's capabilities
/// include tasks.requests.tools.call, this property controls whether each specific tool supports tasks.
///
///
[JsonPropertyName("taskSupport")]
public ToolTaskSupport? TaskSupport { get; set; }
}
///
/// Represents the level of task augmentation support for a tool.
///
///
///
/// This enum defines how a tool interacts with the task augmentation system:
///
/// - : Task augmentation is not allowed (default)
/// - : Task augmentation is supported but not required
/// - : Task augmentation is mandatory
///
///
///
[Experimental(Experimentals.Tasks_DiagnosticId, UrlFormat = Experimentals.Tasks_Url)]
[JsonConverter(typeof(JsonStringEnumConverter))]
public enum ToolTaskSupport
{
///
/// Clients must not attempt to invoke the tool as a task.
///
///
/// This is the default behavior. Servers should return a -32601 (Method not found) error
/// if a client attempts to invoke the tool as a task when this is set.
///
[JsonStringEnumMemberName("forbidden")]
Forbidden,
///
/// Clients may invoke the tool as a task or as a normal request.
///
///
/// When this is set, clients can choose whether to use task augmentation based on their needs.
///
[JsonStringEnumMemberName("optional")]
Optional,
///
/// Clients must invoke the tool as a task.
///
///
/// Servers must return a -32601 (Method not found) error if a client does not attempt
/// to invoke the tool as a task when this is set.
///
[JsonStringEnumMemberName("required")]
Required
}