Description
Expected Behavior
The McpSchema.Tool
class should support the annotations attribute.
Current Behavior
The McpSchema.Tool
class currently only has the name
, description
, and inputSchema
properties.
Context
I believe we need to support the annotations
property in the McpSchema.Tool
class for the following reasons:
-
It is part of the MCP specification: As stated in the MCP specification (https://modelcontextprotocol.io/docs/concepts/tools#tool-definition-structure
), this property is very useful as it allows the MCP server to provide additional descriptions about a tool’s behavior to the client. -
Better integration with the Spring ecosystem (e.g., Spring AI): Supporting this property would enable better interoperability with frameworks like Spring AI. In Spring AI, there is a
returnDirect
attribute for tools(https://docs.spring.io/spring-ai/reference/1.1-SNAPSHOT/api/tools.html#_return_direct), which indicates that the result of the tool call should be returned directly to the user instead of being sent back to the model. However, sinceMcpSchema.Tool
currently lacks a way to carry this attribute,returnDirect
becomes ineffective in MCP scenarios(for details on this point, please refer to: @Tool returnDirect Attribute Ignored spring-projects/spring-ai#3481 (comment) ). I believe it's a good approach to pass this value throughannotations
. -
Support and extension in other language SDKs: The
annotations
property is already supported in MCP SDKs for languages such asPython
andSwift
, and each has extended it in their own way.