-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Add title to tools, resources, prompts #972
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
+481
−46
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add optional title field to core MCP types: - Tool: For human-readable tool display names - Resource: For human-readable resource display names - ResourceTemplate: For human-readable template display names - Prompt: For human-readable prompt display names - Implementation: For human-readable implementation display names The title field provides a way to display user-friendly names in UIs while keeping programmatic names stable. All fields are optional to maintain backwards compatibility. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
cbc2c20
to
68cd574
Compare
Add BaseMetadata base class to provide common name and title fields for consistency with TypeScript SDK implementation. This centralizes the field definitions for Implementation, Tool, Resource, ResourceTemplate, and Prompt classes. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Add optional title field to tools, resources, prompts, and resource templates in FastMCP to enable human-readable display names. Also includes a utility function get_display_name() for consistent title/name precedence handling. - Add title parameter to @tool, @resource, and @prompt decorators - Add title field to Tool, Resource, Prompt, and ResourceTemplate models - Implement get_display_name() utility with proper precedence rules - Add comprehensive tests for title functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Update README and example servers to demonstrate the new title field feature for better human-readable display names. - Add title parameter to decorator examples in README - Update simple-tool example with "Website Fetcher" title - Update simple-resource example with resource-specific titles - Update simple-prompt example with "Simple Assistant Prompt" title 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
- Update simple-chatbot example to show title as separate field for LLM - Add "Client Display Utilities" section to README with usage examples - Enhance get_display_name() documentation to clarify client-side usage This demonstrates best practices for displaying human-readable titles in MCP clients while maintaining programmatic names for tool execution. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
68cd574
to
6fb06d7
Compare
felixweinberger
commented
Jun 17, 2025
ihrpr
previously approved these changes
Jun 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments inline, also please can you add title tools, prompts in test_integration
there is make_everything_fastmcp
1a892bb
to
36234a4
Compare
ihrpr
reviewed
Jun 17, 2025
ihrpr
previously approved these changes
Jun 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry, a few more nits
8a53a85
to
5f94ff7
Compare
- Add titles to all tools, resources, and prompts in make_everything_fastmcp test fixture - Refactor simple-resource server to use single dict for resource data and titles - Add MCP specification link to metadata_utils.py documentation - Add comprehensive test_title_precedence to verify title functionality - Fix missing title field in test_tool_manager.py Tool instantiation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
5f94ff7
to
ef4ca88
Compare
ihrpr
approved these changes
Jun 17, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add support for optional title field across MCP entities to provide human-readable display names separate from programmatic identifiers.
Motivation and Context
This implements the spec change from modelcontextprotocol/modelcontextprotocol#663 to improve user experience by allowing servers to provide human-friendly names for tools, resources, and prompts.
How Has This Been Tested?
Breaking Changes
None - the title field is optional and all existing code continues to work unchanged.
Types of changes
Checklist
Additional context