ExtensionIdentifier implements Stringable
An extension identifier (SEP-2133): a `_meta` key with a mandatory vendor prefix, since an extension is something a vendor owns and an unprefixed name has no owner. Naming rules are enforced at construction, so any `ExtensionIdentifier` in hand is guaranteed well-formed.
The modelcontextprotocol/mcp second label is reserved for official
extensions, so a third party naming itself io.modelcontextprotocol/tasks
would be claiming to be one — see self::isReserved().
Tags
Table of Contents
Interfaces
- Stringable
Constants
- OFFICIAL_PREFIX : mixed = 'io.modelcontextprotocol/'
- Prefixes the specification itself allocates.
- RESERVED_LABELS : mixed = ['modelcontextprotocol', 'mcp']
- Second labels only the specification may use.
- LABEL : mixed = '[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?'
- A label: starts with a letter, ends alphanumeric, hyphens inside.
- NAME : mixed = '[a-zA-Z0-9](?:[a-zA-Z0-9._-]*[a-zA-Z0-9])?'
- A name: alphanumeric at both ends, `-`, `_` and `.` inside.
Properties
- $identifier : string
Methods
- __construct() : mixed
- __toString() : string
- isReserved() : bool
- Whether this identifier claims a prefix the specification reserves.
- check() : string|null
Constants
OFFICIAL_PREFIX
Prefixes the specification itself allocates.
public
mixed
OFFICIAL_PREFIX
= 'io.modelcontextprotocol/'
RESERVED_LABELS
Second labels only the specification may use.
public
mixed
RESERVED_LABELS
= ['modelcontextprotocol', 'mcp']
LABEL
A label: starts with a letter, ends alphanumeric, hyphens inside.
private
mixed
LABEL
= '[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?'
NAME
A name: alphanumeric at both ends, `-`, `_` and `.` inside.
private
mixed
NAME
= '[a-zA-Z0-9](?:[a-zA-Z0-9._-]*[a-zA-Z0-9])?'
Properties
$identifier read-only
private
string
$identifier
Methods
__construct()
public
__construct(string $identifier) : mixed
Parameters
- $identifier : string
Tags
__toString()
public
__toString() : string
Return values
stringisReserved()
Whether this identifier claims a prefix the specification reserves.
public
isReserved() : bool
Not an error on its own — the official extensions legitimately use it — but a third party doing so is misrepresenting itself, so callers that are not the SDK should refuse.
Return values
boolcheck()
private
static check(string $identifier) : string|null
Parameters
- $identifier : string
Return values
string|null —the reason $identifier is invalid, or null when it is well-formed