TsgcWSAPIClient_MCPEvents › OnMCPResponsePrompt

OnMCPResponsePrompt Event

Delivers the rendered prompt content returned by prompts/get.

Syntax

property OnMCPResponsePrompt: TsgcAI_MCP_Client_OnResponsePromptEvent;
// TsgcAI_MCP_Client_OnResponsePromptEvent = procedure(Sender: TObject; const aRequest: TsgcAI_MCP_Request_PromptsGet; const aResponse: TsgcAI_MCP_Response_PromptsGet) of object

Default Value

Remarks

Triggered when the server replies to RequestPrompt. aResponse.Result.Messages contains one or more role-tagged items whose Content.Type determines whether the payload is text, an image, audio, or an embedded resource. Use the sequence to drive a chat view or as conditioning context for an LLM call.

Example

procedure TMainForm.MCPResponsePrompt(Sender: TObject;
  const aRequest: TsgcAI_MCP_Request_PromptsGet;
  const aResponse: TsgcAI_MCP_Response_PromptsGet);
begin
  if aResponse.Result.Messages.Count > 0 then
    Log('Prompt output: ' + aResponse.Result.Messages[0].Content.Text);
end;

Back to Events