TsgcWSAPIClient_MCPEvents › OnMCPListRoots

OnMCPListRoots Event

Fires when the server asks the client for its filesystem roots (roots/list).

Syntax

property OnMCPListRoots: TsgcAI_MCP_Client_OnListRootsEvent;
// TsgcAI_MCP_Client_OnListRootsEvent = procedure(Sender: TObject; const aRequest: TsgcAI_MCP_Request_RootsList; const aResponse: TsgcAI_MCP_Response_RootsList) of object

Default Value

Remarks

Server-initiated event: the server issued a roots/list request or notification to discover which workspace roots (project folders, URIs) the host exposes. Populate aResponse.Result.Roots with the entries you want to advertise. The component replies to the server automatically once the handler returns. Use this event so tools such as code search or file access stay within the boundaries the user has explicitly approved.

Example

procedure TMainForm.MCPListRoots(Sender: TObject;
  const aRequest: TsgcAI_MCP_Request_RootsList;
  const aResponse: TsgcAI_MCP_Response_RootsList);
begin
  aResponse.Result.Roots.Add('file:///C:/Projects/Demo', 'Demo workspace');
end;

Back to Events