Table of Contents

TTMSMCPClient.OnBeforeUseTool Event

Occurs before each tool invocation the model requests, so the application can approve or refuse it.

API unit family: TMS.MCP.Client Declaring type: TTMSMCPClient Inherited from: TTMSMCPCustomClient

Syntax

OnBeforeUseTool: TTMSMCPClientBeforeUseToolEvent;

Remarks

Raised on the thread that runs the model exchange, immediately before the request would be sent, and the decision is final. The starting answer comes from ToolCallMode. A refused invocation yields ToolDeniedMessage to the model and is written to the log at notice severity.

Parameters

Name Description
Sender Client that is about to invoke the tool.
AToolName Name of the tool the model asked for.
AParam Arguments the model supplied, which a handler can inspect to decide. The object belongs to the caller, so read it rather than freeing it.
AAllow Decision the client acts on. It enters set to True when ToolCallMode allows calls outright and False when each call has to be approved; setting it to False refuses this invocation, setting it to True lets it proceed.