ListRootsRequestHandler implements RequestHandlerInterface
Handler for roots/list requests from the server.
since protocol revision 2026-07-28 (SEP-2577), earliest removal 2027-07-28. Pass directories or files through tool arguments, resource URIs or server configuration instead.
The MCP server may ask the client for the list of filesystem roots (its "workspace folders"). This handler wraps a user-provided callback that returns the roots the client wishes to expose.
Tags
Table of Contents
Interfaces
- RequestHandlerInterface
- Interface for handling requests from the server.
Properties
- $callback : RootsCallbackInterface
- $logger : LoggerInterface
Methods
- __construct() : mixed
- handle() : Response<string|int, ListRootsResult>|Error
- Handle the request and return a response or error.
- supports() : bool
- Check if this handler supports the given request.
Properties
$callback read-only
private
RootsCallbackInterface
$callback
$logger read-only
private
LoggerInterface
$logger
= new NullLogger()
Methods
__construct()
public
__construct(RootsCallbackInterface $callback[, LoggerInterface $logger = new NullLogger() ]) : mixed
Parameters
- $callback : RootsCallbackInterface
- $logger : LoggerInterface = new NullLogger()
handle()
Handle the request and return a response or error.
public
handle(Request $request) : Response<string|int, ListRootsResult>|Error
Parameters
- $request : Request
Return values
Response<string|int, ListRootsResult>|Errorsupports()
Check if this handler supports the given request.
public
supports(Request $request) : bool
Parameters
- $request : Request