Skip to content

McpSchema.Tool requires the annotations attribute. #312

Open
@sunyuhan1998

Description

@sunyuhan1998

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:

  1. 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.

  2. 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, since McpSchema.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 through annotations.

  3. Support and extension in other language SDKs: The annotations property is already supported in MCP SDKs for languages such as Python and Swift, and each has extended it in their own way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions