TsgcWSAPIServer_MCP › Methods › HasClientCapability
Returns True when the client of the request declared a capability.
function HasClientCapability(const aSession: TsgcAI_MCP_Session; const aCapability: string): Boolean;
For a 2026-07-28 request the capability is looked up in the client capabilities sent in params._meta, so any key can be checked (for example elicitation, sampling or roots). For a legacy session the capabilities negotiated by initialize are used and the supported values are elicitation, sampling and roots. Returns False when aSession is nil. See Protocol Versions.
if MCPServer.HasClientCapability(aSession, 'roots') then
aResponse.InputRequired.AddRoots('roots');