TsgcWSAPIServer_MCPEvents › OnMCPResponseRootsList

OnMCPResponseRootsList Event

Receives the client’s reply to RequestRootsList, exposing the shared roots.

Syntax

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

Default Value

Remarks

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).

Example

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;

Back to Events