IMcpSampling
Provides direct access to MCP sampling (LLM completions) from the connected client. Inject this interface into command handlers to request completions outside the IReplInteractionChannel abstraction.
- Kind:
Interface - Namespace: Repl.Mcp
- Assembly:
Repl.Mcp - Source: src/Repl.Mcp/IMcpSampling.cs
Signature
Section titled “Signature”public interface IMcpSamplingMethods
Section titled “Methods”SampleAsync(string, int, CancellationToken)
Section titled “SampleAsync(string, int, CancellationToken)”Requests an LLM completion from the connected agent client.
Returns null when the client does not support sampling.
ValueTask<string?> SampleAsync(string prompt, int maxTokens = 1024, CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”prompt(string): The user prompt to send.maxTokens(int): Maximum tokens for the response (default 1024).cancellationToken(CancellationToken): Cancellation token.
Returns
Section titled “Returns”ValueTask<string>
Properties
Section titled “Properties”IsSupported
Section titled “IsSupported”Gets a value indicating whether the connected MCP client supports sampling.
bool IsSupported { get; }