Skip to content

GH-3805: Add title attribute support to MCP @Tool annotation #3806

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

codeboyzhou
Copy link

As the title described, this PR was created to solve issue #3805, please refer to the issue for more details.

@sunyuhan1998
Copy link
Contributor

Actually, @Tool was not originally designed specifically for MCP's tools. It is not an equivalent to McpSchema.Tool. The development of MCP has been too fast. I've noticed that we are trying to add more and more features to @Tool, attempting to bring it closer in functionality to McpSchema.Tool. I believe this is because we initially supported using @Tool to define tools on the MCP server side.

Perhaps we need a set of annotations such as @McpTool, @McpPrompt, and @McpResource, similar to what this project: https://github.com/spring-ai-community/mcp-annotations does. However, at this point, the project doesn't seem mature enough to be merged into Spring AI yet.

@sunyuhan1998
Copy link
Contributor

please sign off your commit to comply with the DCO

@codeboyzhou
Copy link
Author

Actually, @Tool was not originally designed specifically for MCP's tools. It is not an equivalent to McpSchema.Tool. The development of MCP has been too fast. I've noticed that we are trying to add more and more features to @Tool, attempting to bring it closer in functionality to McpSchema.Tool. I believe this is because we initially supported using @Tool to define tools on the MCP server side.

Perhaps we need a set of annotations such as @McpTool, @McpPrompt, and @McpResource, similar to what this project: https://github.com/spring-ai-community/mcp-annotations does. However, at this point, the project doesn't seem mature enough to be merged into Spring AI yet.

Oh I see, thanks for your patient explanation. That was also my confusion why there is no @Prompt and @Resource, you tell me the answer now.

By the way, for the annotations @McpTool, @McpPrompt, and @McpResource, I am a little familiar, but it's not due to spring-ai-community, actually I didn't know about this community, so I created a personal repository to do the things same like mcp-annotations months ago, just want to make my MCP exploration journey easier, because the native MCP Java SDK is a bit cumbersome to use, but after all, it's underlying implementation. I will learn about the project spring-ai-community/mcp-annotations you mentioned, thanks again.

- Add title field to DefaultToolDefinition and ToolDefinition interfaces
- Modify ToolDefinitions and ToolUtils to support new title field
- Adjust McpToolUtils to use title in tool specification

Signed-off-by: codeboyzhou <[email protected]>
@codeboyzhou codeboyzhou force-pushed the feat-add-title-for-tool-annotation branch from 833c169 to dafaad0 Compare July 14, 2025 05:42
@codeboyzhou
Copy link
Author

please sign off your commit to comply with the DCO

Thank you for the reminder. It's already done.

@ilayaperumalg ilayaperumalg added MCP enhancement New feature or request labels Jul 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request MCP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants