Summary
The MCP specification (2025-11-25) defines an optional title field for Resource
and ResourceTemplate, but the PHP SDK does not implement it.
Spec definition
The Resources specification
lists the following fields for Resource:
uri: Unique identifier for the resource
name: The name of the resource.
title: Optional human-readable name of the resource for display purposes.
Example from the spec:
{
"uri": "file:///project/src/main.rs",
"name": "main.rs",
"title": "Rust Software Application Main File",
"description": "Primary application entry point",
"mimeType": "text/x-rust"
}
ResourceTemplate follows the same pattern:
{
"uriTemplate": "file:///{path}",
"name": "Project Files",
"title": "📁 Project Files",
"description": "Access files in the project directory"
}
All four server capability types in the spec define title as the optional
human-readable display label:
| Type |
Machine identifier |
title |
Tool |
name |
optional, implemented |
Prompt |
name |
optional, implemented |
Resource |
uri |
optional, missing |
ResourceTemplate |
uriTemplate |
optional, missing |
Current SDK behaviour
Mcp\Schema\Resource and Mcp\Schema\ResourceTemplate have no title constructor
parameter, no title property, and do not include title in jsonSerialize().
Servers that want to expose a human-readable label for a resource currently have no
way to do so.
Additionally, the docblock for Resource::$name currently reads:
A human-readable name for this resource. This can be used by clients to populate
UI elements.
This description conflicts with the spec, where name is a short identifier (e.g.
"main.rs") and title is the human-readable display label.
Proposed fix
Add public readonly ?string $title = null to both Resource and ResourceTemplate,
include it in fromArray() and jsonSerialize(), and update the $name docblock to
match the spec.
Summary
The MCP specification (2025-11-25) defines an optional
titlefield forResourceand
ResourceTemplate, but the PHP SDK does not implement it.Spec definition
The Resources specification
lists the following fields for
Resource:Example from the spec:
{ "uri": "file:///project/src/main.rs", "name": "main.rs", "title": "Rust Software Application Main File", "description": "Primary application entry point", "mimeType": "text/x-rust" }ResourceTemplatefollows the same pattern:{ "uriTemplate": "file:///{path}", "name": "Project Files", "title": "📁 Project Files", "description": "Access files in the project directory" }All four server capability types in the spec define
titleas the optionalhuman-readable display label:
titleToolnamePromptnameResourceuriResourceTemplateuriTemplateCurrent SDK behaviour
Mcp\Schema\ResourceandMcp\Schema\ResourceTemplatehave notitleconstructorparameter, no
titleproperty, and do not includetitleinjsonSerialize().Servers that want to expose a human-readable label for a resource currently have no
way to do so.
Additionally, the docblock for
Resource::$namecurrently reads:This description conflicts with the spec, where
nameis a short identifier (e.g."main.rs") andtitleis the human-readable display label.Proposed fix
Add
public readonly ?string $title = nullto bothResourceandResourceTemplate,include it in
fromArray()andjsonSerialize(), and update the$namedocblock tomatch the spec.