MCP PHP SDK

ListRootsRequest extends Request

FinalYes

Sent from the server to request a list of root URIs from the client. Roots allow servers to ask for specific directories or files to operate on. A common example for roots is providing a set of repositories or directories a server should operate on.

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.

This request is typically used when the server needs to understand the file system structure or access specific locations that the client has permission to read from.

Tags
author

Kyrian Obikwelu koshnawaza@gmail.com

Table of Contents

Properties

$id  : string|int
$meta  : array<string, mixed>|null

Methods

__construct()  : mixed
fromArray()  : static
getId()  : string|int
getMeta()  : array<string, mixed>|null
getMethod()  : string
jsonSerialize()  : RequestData
requiresJsonTypes()  : bool
Whether the request cannot be served from params that lost the difference between `{}` and `[]`.
withId()  : static
withMeta()  : static
fromParams()  : static
getParams()  : array<non-empty-string, mixed>|null
paramsToArray()  : array<string, mixed>

Properties

$meta

protected array<string, mixed>|null $meta = null

Methods

fromArray()

public static fromArray(RequestData $data) : static
Parameters
$data : RequestData
Return values
static

getId()

public getId() : string|int
Return values
string|int

getMeta()

public getMeta() : array<string, mixed>|null
Return values
array<string, mixed>|null

jsonSerialize()

public jsonSerialize() : RequestData
Return values
RequestData

requiresJsonTypes()

Whether the request cannot be served from params that lost the difference between `{}` and `[]`.

public static requiresJsonTypes() : bool
Return values
bool

withId()

public withId(string|int $id) : static
Parameters
$id : string|int
Return values
static

withMeta()

public withMeta(array<string, mixed>|null $meta) : static
Parameters
$meta : array<string, mixed>|null
Return values
static

fromParams()

protected static fromParams(array<string|int, mixed>|null $params) : static
Parameters
$params : array<string|int, mixed>|null
Return values
static

getParams()

protected getParams() : array<non-empty-string, mixed>|null
Return values
array<non-empty-string, mixed>|null

paramsToArray()

protected static paramsToArray(stdClass $params) : array<string, mixed>
Parameters
$params : stdClass
Return values
array<string, mixed>
On this page

Search results