1: | <?php |
2: | |
3: | declare(strict_types=1); |
4: | |
5: | /** |
6: | * This file is part of the Nexus MCP SDK package. |
7: | * |
8: | * (c) 2025 John Paul E. Balandan, CPA <paulbalandan@gmail.com> |
9: | * |
10: | * For the full copyright and license information, please view |
11: | * the LICENSE file that was distributed with this source code. |
12: | */ |
13: | |
14: | namespace Nexus\Mcp\Server\Message\Request; |
15: | |
16: | use Nexus\Mcp\Message\Request; |
17: | use Nexus\Mcp\ProgressToken; |
18: | |
19: | /** |
20: | * Sent from the server to request a list of root URIs from the client. Roots allow servers to ask |
21: | * for specific directories or files to operate on. A common example for roots is providing a set of |
22: | * repositories or directories a server should operate on. |
23: | * |
24: | * This request is typically used when the server needs to understand the file system structure or |
25: | * access specific locations that the client has permission to read from. |
26: | */ |
27: | final readonly class ListRootsRequest extends Request implements ServerRequest |
28: | { |
29: | /** |
30: | * @param non-empty-string $jsonrpc JSON-RPC version. Must be 2.0. |
31: | * @param null|ProgressToken $progressToken If specified, the caller is requesting out-of-band progress |
32: | * notifications for this request (as represented by |
33: | * `notifications/progress`). The value of this parameter is an |
34: | * opaque token that will be attached to any subsequent notifications. |
35: | * The receiver is not obligated to provide these notifications. |
36: | */ |
37: | public function __construct( |
38: | string $jsonrpc, |
39: | public ?ProgressToken $progressToken = null, |
40: | ) { |
41: | $params = null === $progressToken ? null : ['_meta' => ['progressToken' => $progressToken->token]]; |
42: | |
43: | parent::__construct($jsonrpc, 'roots/list', $params); |
44: | } |
45: | } |
46: |