Table of Contents

TTMSMCPServer.OnTaskExecute Event

Occurs on a background thread to execute a task. Assigning a handler replaces the built-in tool runner, making the handler responsible for completing the task through SetTaskResult or SetTaskError.

API unit family: TMS.MCP.Server Declaring type: TTMSMCPServer Inherited from: TTMSMCPCustomServer

Syntax

OnTaskExecute: TTMSMCPTaskExecuteEvent;

Remarks

The handler runs on a background thread, not on the main thread. An exception that escapes it is caught and turned into a task error.

Parameters

Name Description
Sender Server that owns the task.
ATaskId Identifier of the task to execute, needed to report its result or its failure.
AToolName Name of the tool the client asked for.
AArguments Call arguments. The instance is owned by the server and released once execution returns; clone anything that must outlive the call.