Table of Contents

Method ReadResourceAsync

Namespace
LMKit.Mcp.Client
Assembly
LM-Kit.NET.dll

ReadResourceAsync(string, CancellationToken)

Reads the content of a specific resource from the server.

public Task<IReadOnlyList<McpResourceContent>> ReadResourceAsync(string uri, CancellationToken cancellationToken = default)

Parameters

uri string

The URI of the resource to read.

cancellationToken CancellationToken

Optional cancellation token to cancel the operation.

Returns

Task<IReadOnlyList<McpResourceContent>>

A read-only list of McpResourceContent entries representing the resource content.

Exceptions

ArgumentException

Thrown when uri is null or whitespace.

ObjectDisposedException

Thrown when the client has been disposed.

InvalidOperationException

Thrown when the server payload is malformed or the resource is missing.

HttpRequestException

Thrown when the HTTP request fails or the server returns an error.