MCP PHP SDK

Root implements JsonSerializable

Represents a root directory or file that the server can operate on.

Tags
author

Kyrian Obikwelu koshnawaza@gmail.com

Table of Contents

Interfaces

JsonSerializable

Constants

URI_PATTERN  = '/^file:\/\/.*$/'

Properties

$name  : string|null
$uri  : string

Methods

__construct()  : mixed
fromArray()  : self
jsonSerialize()  : RootData

Constants

URI_PATTERN

private mixed URI_PATTERN = '/^file:\/\/.*$/'

Properties

$name read-only

public string|null $name = null

$uri read-only

public string $uri

Methods

__construct()

public __construct(string $uri[, string|null $name = null ]) : mixed
Parameters
$uri : string

The URI identifying the root. This must start with file:// for now.

This restriction may be relaxed in future versions of the protocol to allow other URI schemes.

$name : string|null = null

An optional name for the root.

This can be used to provide a human-readable identifier for the root, which may be useful for display purposes or for referencing the root in other parts of the application.

fromArray()

public static fromArray(RootData $data) : self
Parameters
$data : RootData
Return values
self

jsonSerialize()

public jsonSerialize() : RootData
Return values
RootData

        
On this page

Search results