8000 Encourage title properties/usage for objects/resources likely t… by ZachGerman · Pull Request #663 · modelcontextprotocol/modelcontextprotocol · GitHub
[go: up one dir, main page]

Skip to content

Encourage title properties/usage for objects/resources likely t… #663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 13, 2025

Conversation

ZachGerman
Copy link
Contributor
@ZachGerman ZachGerman commented Jun 6, 2025

Encourage UI-friendly naming by introducing a dedicated optional title property across the specification and updating all related examples to include it.

  • Added optional title field to resource, tool, prompt, clientInfo, and serverInfo definitions in the spec.
  • Updated JSON examples to include title entries where they're likely to be used.

Motivation and Context

By introducing title as a dedicated property, we ensure clarity and consistency in how data is surfaced to end users, improving both developer experience and user-facing usability as the protocol evolves.

Breaking Changes

Will users need to update their code or configurations? No. According to the language added to the spec, "if no title is provided, name should be used for display purposes". Thus, implementations currently leveraging name variables for display will be preserved.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

To be added to docs if/when this PR is published to an official spec version:

Naming conventions:

  • Objects with names expose two distinct properties: name and title. The name is intended for programmatic or logical use, while title is intended for UI and end-user contexts — optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology.

@bhosmer-ant
Copy link
Contributor

Hi @ZachGerman - interested in your thoughts on a couple of things, just thinking out loud:

  • the "just use name if displayName is not provided" is nice for new client / old server compatibility. For old client / new server situations, it will mean tool names might be less readable than previously. I don't think this is a dealbreaker, but wanted to flag it.
  • wonder if you've thought about when to use displayName vs. annotations.title for tools. We might want to give some guidance about that in the new language.

@dsp-ant dsp-ant moved this from Consulting to In Review in Standards Track Jun 10, 2025
Copy link
Contributor
@connor4312 connor4312 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MCP already uses the title for the "displayName" in ToolAnnotations.title. Could we normalize one direction or the other?

@@ -264,6 +267,7 @@ Example tool with output schema:
```json
{
"name": "get_weather_data",
"displayName": "Weather Data Retriever",
Copy link
Contributor
@connor4312 connor4312 Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't appear to be represented in the spec change and is duplicative with existing ToolAnnotations.title

@bhosmer-ant
Copy link
Contributor

Hi @ZachGerman - this is definitely a useful addition and we'd like to add it to the draft spec, but with the following changes:

  • instead of adding displayName as a top-level property, create a BaseMetadata interface that contains name and title (rather than displayName)
  • for any type that contains name, inherit from that interface instead. (This will give us a place to make further additions later.)
  • for the documentation (in addition to changing displayName to title globally) we'd want to add language in Tool noting that in addition to the "first title then fall back to name" precedence order you specify elsewhere, for tools it should be "first title then annotations.title then name"

Realize this is a nontrivial set of edits and we're on a fairly tight schedule for the spec release, so if you don't have time/bandwidth in the next day or so we're happy to make the changes. Just LMK!

@ZachGerman ZachGerman force-pushed the feature/displayName branch 2 times, most recently from 6b634a1 to f00ada8 Compare June 11, 2025 21:29
@ZachGerman
Copy link
Contributor Author

Hi @ZachGerman - this is definitely a useful addition and we'd like to add it to the draft spec, but with the following changes:

* instead of adding `displayName` as a top-level property, create a `BaseMetadata` interface that contains `name` and `title` (rather than `displayName`)

* for any type that contains `name`, inherit from that interface instead. (This will give us a place to make further additions later.)

* for the documentation (in addition to changing `displayName` to `title` globally) we'd want to add language in `Tool` noting that in addition to the "first `title` then fall back to `name`" precedence order you specify elsewhere, for tools it should be "first `title` then `annotations.title` then `name`"

Realize this is a nontrivial set of edits and we're on a fairly tight schedule for the spec release, so if you don't have time/bandwidth in the next day or so we're happy to make the changes. Just LMK!

Done. Please let me know if anything else needs changed. I'm on-call this week, so I won't finish the server transport until next week, but this PR is small enough to keep up with during my on-call.

@ZachGerman ZachGerman force-pushed the 8000 feature/displayName branch from f00ada8 to 1c54a77 Compare June 11, 2025 21:36
@ZachGerman ZachGerman changed the title Encourage displayName properties/usage for objects/resources likely t… Encourage title properties/usage for objects/resources likely t… Jun 11, 2025
@bhosmer-ant
Copy link
Contributor

Awesome! Will review shortly but also please fix the merge conflicts when you have a chance. Thanks for the quick turnaround!

@bhosmer-ant
Copy link
Contributor

Ugh sorry to do this to you but it looks like you need to rerun npm run generate:json 🙏 (also I'm not sure why the PR is still showing "out of date with the base branch" after your merge, but as long as there are no conflicts it should be innocuous)

@ZachGerman
Copy link
Contributor Author

Ugh sorry to do this to you but it looks like you need to rerun npm run generate:json 🙏 (also I'm not sure why the PR is still showing "out of date with the base branch" after your merge, but as long as there are no conflicts it should be innocuous)

Should be fixed now.

@bhosmer-ant bhosmer-ant enabled auto-merge June 12, 2025 02:07
@bhosmer-ant
Copy link
Contributor

Hi @ZachGerman - had to make one change, Root.name was a different beast than the rest (optional, so making it mandatory would be bc-breaking, and paired with a URI, which arguably can serve as a machine-friendly id). Also it's not in your original list of candidates, so I suspect it might've been an accidental change.

Having pushed the change I can't merge it, but it should go in shortly. Thanks again for doing this!

8000 bhosmer-ant self-requested a review June 12, 2025 02:16
bhosmer-ant
bhosmer-ant previously approved these changes Jun 12, 2025
Copy link
Contributor
@bhosmer-ant bhosmer-ant left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor
@ihrpr ihrpr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we also need to update PromptReference?

@@ -264,10 +264,29 @@ export interface ServerCapabilities {
}

/**
* Describes the name and version of an MCP implementation.
* Base interface for metadata with name and title (display name) properties.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we hint that name is an identifier?

Suggested change
* Base interface for metadata with name and title (display name) properties.
* Base interface for metadata with name (identifier) and title (display name) properties.

@bhosmer-ant
Copy link
Contributor

do we also need to update PromptReference?

yes! thanks for catching

@bhosmer-ant
Copy link
Contributor
bhosmer-ant commented Jun 12, 2025

[edited] back to plan A, will land this as-is + @ihrpr suggestion (I'll push it shortly)

@bhosmer-ant bhosmer-ant requested review from dsp-ant and ihrpr June 12, 2025 22:14
Copy link
Contributor
@ihrpr ihrpr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Approved
4A1C
Development

Successfully merging this pull request may close these issues.

5 participants
0