Skip to content

Pass the tool name to ToolContextToMcpMetaConverter - #7472

Open
erywim wants to merge 1 commit into
spring-projects:mainfrom
erywim:feat/mcp-tool-meta-converter-tool-name
Open

erywim wants to merge 1 commit into
spring-projects:mainfrom
erywim:feat/mcp-tool-meta-converter-tool-name

Conversation

@erywim

@erywim erywim commented Nov 25, 2026 •

Copy link
Copy Markdown

ToolContextToMcpMetaConverter could only see the ToolContext, so an application could not tailor the _meta entries of a tool call to the tool being called.

This adds a convert(ToolContext, String toolName) overload and passes the name of the tool on the MCP server from the legacy and modern, synchronous and asynchronous callbacks. The new method is a default method that delegates to the existing convert(ToolContext), so existing implementations, including lambdas, keep working unchanged.

Tests: the converter tests cover the default delegation and an override that uses the tool name. The callback tests verify that the async and sync legacy callbacks forward the original tool name, and a modern client test covers the same through ModernToolCalls.requestMeta. The mcp/common suite passes.

Fixes #4958

The converter could only see the ToolContext, so an application could not
tailor the `_meta` entries of a call to the tool being called. Add a
convert(ToolContext, String toolName) overload and pass the name of the
tool on the MCP server from the legacy and modern, synchronous and
asynchronous callbacks.

The new method is a default method that delegates to the existing
convert(ToolContext), so existing implementations, including lambdas,
keep working unchanged.

Closes spring-projects#4958

Signed-off-by: Erywim <59912860+erywim@users.noreply.github.com>
@erywim
erywim force-pushed the feat/mcp-tool-meta-converter-tool-name branch from 05e78ba to 24e48ec Compare November 25, 2026 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Provide Toolname to ToolContextToMcpMetaConverter.convert

2 participants