TsgcWSAPIClient_MCP › Events › OnMCPTaskCompleted

OnMCPTaskCompleted Event

Fires when a task reaches a terminal status (completed, failed or cancelled).

Syntax

property OnMCPTaskCompleted: TsgcAI_MCP_Client_OnTaskEvent;
// TsgcAI_MCP_Client_OnTaskEvent = procedure(Sender: TObject; const aTask: TsgcAI_MCP_Client_Task) of object

Default Value

—

Remarks

Read the tool result from aTask.Result or the error from aTask.Error. Polling of the task stops after this event.

When raised by the poller the event runs in the background thread of the task; use TThread.Queue or TThread.Synchronize to update visual controls. See Tasks.

Example

procedure TMainForm.MCPTaskCompleted(Sender: TObject;
  const aTask: TsgcAI_MCP_Client_Task);
begin
  if aTask.Status = aimcptskCompleted then
    Log(aTask.Result);
end;

Back to Events