Class MCPTool
Give the model access to additional tools via remote Model Context Protocol (MCP) servers.
public sealed class MCPTool : ITool
- Inheritance
-
MCPTool
- Implements
- Inherited Members
Constructors
MCPTool()
public MCPTool()
MCPTool(string, string, IReadOnlyList<string>, IReadOnlyDictionary<string, object>, MCPApprovalFilter)
public MCPTool(string serverLabel, string serverUrl, IReadOnlyList<string> allowedTools, IReadOnlyDictionary<string, object> headers, MCPApprovalFilter requireApproval)
Parameters
serverLabel
stringserverUrl
stringallowedTools
IReadOnlyList<string>headers
IReadOnlyDictionary<string, object>requireApproval
MCPApprovalFilter
MCPTool(string, string, IReadOnlyList<string>, IReadOnlyDictionary<string, object>, object)
public MCPTool(string serverLabel, string serverUrl, IReadOnlyList<string> allowedTools = null, IReadOnlyDictionary<string, object> headers = null, object requireApproval = null)
Parameters
serverLabel
stringserverUrl
stringallowedTools
IReadOnlyList<string>headers
IReadOnlyDictionary<string, object>requireApproval
object
MCPTool(string, string, IReadOnlyList<string>, IReadOnlyDictionary<string, object>, string)
public MCPTool(string serverLabel, string serverUrl, IReadOnlyList<string> allowedTools, IReadOnlyDictionary<string, object> headers, string requireApproval)
Parameters
serverLabel
stringserverUrl
stringallowedTools
IReadOnlyList<string>headers
IReadOnlyDictionary<string, object>requireApproval
string
Properties
AllowedTools
List of allowed tool names.
[JsonInclude]
[JsonPropertyName("allowed_tools")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyList<string> AllowedTools { get; }
Property Value
Headers
Optional HTTP headers to send to the MCP server. Use for authentication or other purposes.
[JsonInclude]
[JsonPropertyName("headers")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public IReadOnlyDictionary<string, object> Headers { get; }
Property Value
RequireApproval
Specify which of the MCP server's tools require approval. Can be one of MCPApprovalFilter, "always", or "never". When set to "never", all tools will not require approval.
[JsonInclude]
[JsonPropertyName("require_approval")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonConverter(typeof(StringOrObjectConverter<MCPApprovalFilter>))]
public object RequireApproval { get; }
Property Value
ServerLabel
A label for this MCP server, used to identify it in tool calls.
[JsonInclude]
[JsonPropertyName("server_label")]
public string ServerLabel { get; }
Property Value
ServerUrl
The URL for the MCP server.
[JsonInclude]
[JsonPropertyName("server_url")]
public string ServerUrl { get; }
Property Value
Type
[JsonInclude]
[JsonPropertyName("type")]
public string Type { get; }
Property Value
Operators
implicit operator Tool(MCPTool)
public static implicit operator Tool(MCPTool mcpTool)
Parameters
mcpTool
MCPTool