TsgcWSAPIClient_MCP › Events › OnMCPResponseTool
Delivers the result of a tools/call invocation.
property OnMCPResponseTool: TsgcAI_MCP_Client_OnResponseToolEvent;
// TsgcAI_MCP_Client_OnResponseToolEvent = procedure(Sender: TObject; const aRequest: TsgcAI_MCP_Request_ToolsCall; const aResponse: TsgcAI_MCP_Response_ToolsCall) of object
—
Triggered when the server returns a reply to RequestTool. Inspect aResponse.Result.Content for the returned items (text, images, embedded resources) and aResponse.Result.IsError for tool-reported failures. The matching request is available in aRequest.Params.Name and aRequest.Params.Arguments so you can correlate concurrent tool calls.
procedure TMainForm.MCPResponseTool(Sender: TObject;
const aRequest: TsgcAI_MCP_Request_ToolsCall;
const aResponse: TsgcAI_MCP_Response_ToolsCall);
begin
if aResponse.Result.IsError then
Log('Tool ' + aRequest.Params.Name + ' failed')
else
Log('Tool ' + aRequest.Params.Name + ' -> ' + aResponse.Write);
end;