TsgcWSAPIClient_MCP › Events › OnMCPTaskCreated

OnMCPTaskCreated Event

Fires when a tools/call returns a task handle instead of the tool result.

Syntax

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

Default Value

—

Remarks

Raised before OnMCPResponseTool, which receives the raw task handle in aResponse.TaskResult. Store aTask.TaskId to call TasksGet, TasksUpdate or TasksCancel. Requires MCPOptions.Tasks.Enabled.

See Tasks.

Example

procedure TMainForm.MCPTaskCreated(Sender: TObject;
  const aTask: TsgcAI_MCP_Client_Task);
begin
  FTaskId := aTask.TaskId;
end;

Back to Events