Table of Contents

TTMSMCPCustomServer.RequestSampling Method

Asks the connected client to run a model completion on the server's behalf and blocks until the client answers.

API unit family: TMS.MCP.Server Declaring type: TTMSMCPCustomServer

Syntax

function RequestSampling(const Request: TTMSMCPSamplingRequest): TTMSMCPSamplingResult;

Remarks

Call this from inside a tool implementation so the request is routed to the session that made the call. The wait is bounded; the call fails if the client does not answer in time.

Parameters

Name Description
Request Messages, model preferences and sampling parameters to send.

Returns

Completion returned by the client.

Exceptions

Exception Description
Exception Raised when no client has initialized, when sampling is disabled, when the client reports an error, or when no valid response arrives.