Method RegisterAsync
RegisterAsync(McpClient, bool, CancellationToken)
Asynchronously registers all tools from an MCP client.
public Task<int> RegisterAsync(McpClient mcpClient, bool overwrite = false, CancellationToken cancellationToken = default)
Parameters
mcpClientMcpClientAn initialized MCP client.
overwriteboolWhen
true, replaces existing tools with the same name.cancellationTokenCancellationTokenA token to monitor for cancellation requests.
Returns
Exceptions
- ArgumentNullException
Thrown when
mcpClientisnull.
RegisterAsync(McpClient, Func<McpTool, bool>, bool, CancellationToken)
Asynchronously registers filtered tools from an MCP client.
public Task<int> RegisterAsync(McpClient mcpClient, Func<McpTool, bool> filter = null, bool overwrite = false, CancellationToken cancellationToken = default)
Parameters
mcpClientMcpClientAn initialized MCP client.
filterFunc<McpTool, bool>A predicate to filter tools. Return
trueto include,falseto exclude. Passnullto include all tools.overwriteboolWhen
true, replaces existing tools with the same name.cancellationTokenCancellationTokenA token to monitor for cancellation requests.