spring-projects / spring-projects/spring-ai
Automatic conversion of `_meta` field to/from `Tool Context` for methods annotated with @Tool
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 6
Description
Expected Behavior
On MCP Server Side when using @Tool annotation with additional Tool Context argument _meta field data should be automatically converted to ToolContext.
Current Behavior
This change already incorporated changes for MCP Client Side, but the server is still missing the conversion.
McpToolUtils is missing the _meta field to ToolContext information extraction part.
Context
I am trying to pass sensitive information to the tools between MCP Client and MCP Server through the ToolContext mechanism, but the current 1.1.0-M2 MCP implementation doesn't support it. Unfortunately there is also no mechanism that can add additional request handlers on server side nor a mechanism to provide custom implementation for ToolSpecification creation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in mcp/common/src/main/java/org/springframework/ai/mcp/McpToolUtils.java around line 242 and compare the existing MCP client-side conversion from commit e56eb12aae4120476e4d77dd322b3a2e5d0b8736. Confirm that server-side @Tool handling extracts the _meta data into ToolContext and that the resulting context is available to the tool.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100