Skip to content

Resource and ResourceTemplate are missing the title field #296

Closed

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.

Activity

  1. added
    enhancementRequest for a new feature that's not currently supported
    on May 1, 2026
  2. added
    SchemaIssues & PRs related to the Schema component
    improves spec complianceImproves consistency with other SDKs such as TyepScript
    on May 8, 2026
  3. chr-hertel commented on May 8, 2026

    @chr-hertel
    Member

    Thanks, that is correct, would need a patch similar to #278 and #288 - PR welcome of course :)

  4. added
    help wantedContributions especially welcome if you have a good knowledge of the codebase and language
    ready for workEnough information for someone to start working on
    on May 8, 2026
  5. blackwell-systems commented on May 10, 2026

    @blackwell-systems
    Contributor

    PR: #301

  6. added a commit that references this issue on May 17, 2026
    a820497
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    SchemaIssues & PRs related to the Schema componentenhancementRequest for a new feature that's not currently supportedhelp wantedContributions especially welcome if you have a good knowledge of the codebase and languageimproves spec complianceImproves consistency with other SDKs such as TyepScriptready for workEnough information for someone to start working on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions