Table of Contents

Class ToolChoice

Namespace
ModelContextProtocol.Protocol
Assembly
ModelContextProtocol.Core.dll

Controls tool selection behavior for sampling requests.

[Obsolete("The Sampling feature is deprecated as of specification version 2026-07-28 and may be removed in a future version. See SEP-2577 for more information.", DiagnosticId = "MCP9005", UrlFormat = "https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/list-of-diagnostics.md#obsolete-apis")]
public sealed class ToolChoice
Inheritance
ToolChoice
Inherited Members

Properties

Mode

Gets or sets the mode that controls which tools the model can call.

[JsonPropertyName("mode")]
public string? Mode { get; set; }

Property Value

string

Remarks

  • "auto"Model decides whether to call tools (default)
  • "required"Model must call at least one tool
  • "none"Model must not call any tools