Method GetResourcesAsync
GetResourcesAsync(CancellationToken)
Retrieves the list of resources offered by the server. Results are cached after the first call until invalidation or a manual refresh.
public Task<IReadOnlyCollection<McpResource>> GetResourcesAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenOptional cancellation token to cancel the operation.
Returns
- Task<IReadOnlyCollection<McpResource>>
A read-only collection of McpResource values representing the server resources.
Exceptions
- ObjectDisposedException
Thrown when the client has been disposed.
- InvalidOperationException
Thrown when the server response is malformed.
- HttpRequestException
Thrown when the HTTP request fails or the server returns an error.