TsgcWSAPIServer_MCPMethods › RequestRootsList

RequestRootsList Method

Sends a roots/list request to the MCP client identified by the session.

Syntax

function RequestRootsList(const aSessionId: string): Boolean;

Parameters

NameTypeDescription
aSessionIdconst stringIdentifier of the target MCP session, typically the value carried by the Mcp-Session-Id header.

Return Value

Returns True when the session exists and the request was dispatched over its streaming connection; False when the session is unknown or idle. (Boolean)

Remarks

Issues a server-initiated roots/list JSON-RPC call to the client bound to the specified session. The reply is returned asynchronously through OnMCPResponseRootsList. Because the request flows client-bound, the transport must support streaming: enable TransportOptions.HttpStreamable (or keep an SSE connection open) so the session actually has an active connection to write on.

Example

if not MCPServer.RequestRootsList(SessionId) then
  MemoLog.Lines.Add('Session ' + SessionId + ' is not connected.');

Back to Methods