TsgcWSAPIClient_MCP › Events › OnMCPTaskCompleted
Fires when a task reaches a terminal status (completed, failed or cancelled).
property OnMCPTaskCompleted: TsgcAI_MCP_Client_OnTaskEvent;
// TsgcAI_MCP_Client_OnTaskEvent = procedure(Sender: TObject; const aTask: TsgcAI_MCP_Client_Task) of object
—
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.
procedure TMainForm.MCPTaskCompleted(Sender: TObject;
const aTask: TsgcAI_MCP_Client_Task);
begin
if aTask.Status = aimcptskCompleted then
Log(aTask.Result);
end;