spring-projects / spring-projects/spring-ai

Automatic conversion of `_meta` field to/from `Tool Context` for methods annotated with @Tool

Open
#4,526 2 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

mcp status: feedback-provided
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.