TsgcWSAPIServer_MCP › Events › OnMCPResponseRootsList
Receives the client’s reply to RequestRootsList, exposing the shared roots.
property OnMCPResponseRootsList: TsgcAI_MCP_Server_OnResponseRootsListEvent;
// TsgcAI_MCP_Server_OnResponseRootsListEvent = procedure(Sender: TObject; const aSession: TsgcAI_MCP_Session; const aRequest: TsgcAI_MCP_Request_RootsList; const aResponse: TsgcAI_MCP_Response_RootsList) of object
—
Raised asynchronously when the MCP client answers a roots/list call previously sent with RequestRootsList. Iterate aResponse.Result.Roots to read each root’s URI and display name, and store or merge them into your application workflow (for instance to limit the files a tool is allowed to touch).
procedure TMainForm.MCPServerMCPResponseRootsList(Sender: TObject;
const aSession: TsgcAI_MCP_Session; const aRequest: TsgcAI_MCP_Request_RootsList;
const aResponse: TsgcAI_MCP_Response_RootsList);
var
i: Integer;
begin
for i := 0 to aResponse.Result.Roots.Count - 1 do
MemoLog.Lines.Add('root: ' + aResponse.Result.Roots.Items[i].Uri);
end;