TsgcWSAPIServer_MCP › Events › OnMCPTaskCancel

OnMCPTaskCancel Event

Raised when a client cancels a task with tasks/cancel.

Syntax

property OnMCPTaskCancel: TsgcAI_MCP_Server_OnTaskCancelEvent;
// TsgcAI_MCP_Server_OnTaskCancelEvent = procedure(Sender: TObject; const aTask: TsgcAI_MCP_Task) of object

Default Value

—

Remarks

Part of the tasks extension of MCP 2026-07-28. The task is already marked as cancelled when the event fires, so aTask.IsCancelled returns True; stop the background work that runs the task. The event is published, so you can assign it in the Object Inspector or in code. See Tasks.

Example

procedure TMainForm.OnMCPTaskCancelEvent(Sender: TObject;
  const aTask: TsgcAI_MCP_Task);
begin
  MemoLog.Lines.Add('#task_cancel ' + aTask.TaskId);
end;

MCPServer.OnMCPTaskCancel := OnMCPTaskCancelEvent;

Back to Events