Table of Contents

Method ReadResource

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

ReadResource(string, CancellationToken)

Reads the content of a specific resource from the server (synchronous wrapper).

public IReadOnlyCollection<McpResourceContent> ReadResource(string uri, CancellationToken cancellationToken = default)

Parameters

uri string

The URI of the resource to read (e.g., "file:///project/README.md", "schema://database"). Must not be null or whitespace.

cancellationToken CancellationToken

Optional cancellation token to cancel the operation.

Returns

IReadOnlyCollection<McpResourceContent>

A read-only collection 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.