Skip to content

Resource and ResourceTemplate are missing the title field #296

@Chi-teck

Description

@Chi-teck

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementRequest for a new feature that's not currently supported

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions