TTMSMCPServer.OnSamplingRequest Event
Occurs when a
sampling/createMessagerequest arrives at this server and a model completion must be produced. Assign a result in the handler.
API unit family: TMS.MCP.Server
Declaring type: TTMSMCPServer
Inherited from: TTMSMCPCustomServer
Syntax
OnSamplingRequest: TTMSMCPSamplingEvent;
Remarks
The request is only dispatched once initialization has completed and EnableSampling is True; otherwise it is refused as an unknown method. Leaving this event unassigned while sampling is enabled makes every such request fail with an internal error.
Parameters
| Name | Description |
|---|---|
Sender |
Server that received the request. |
SamplingRequest |
Parsed request: messages, model preferences, system prompt and sampling parameters. It is owned by the server and released once the handler returns. |
AResult |
Result to return. Assign a completed result object; the server serializes and then releases it. |