Method RefreshTools
RefreshTools(CancellationToken)
Synchronously clears the cached tool list and fetches a fresh catalog via tools/list
.
public IReadOnlyCollection<McpTool> RefreshTools(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenToken to cancel the operation.
Returns
- IReadOnlyCollection<McpTool>
The refreshed server tool catalog.
Remarks
This is a blocking convenience wrapper over RefreshToolsAsync(CancellationToken). If needed, it first initializes the MCP session. The returned collection is also cached for subsequent Tools access.
Prefer RefreshToolsAsync(CancellationToken) in async code paths to avoid blocking.
Exceptions
- ObjectDisposedException
Thrown if the client has been disposed.
- HttpRequestException
Thrown on HTTP failures, JSON-RPC errors, malformed payloads, or if the server returns an error.
- OperationCanceledException
Thrown if the operation is canceled.
- See Also