Please do a quick search on GitHub issues first, the feature you are about to request might have already been requested.

Expected Behavior

When the tools of MCP Server change, the Agent needs to be aware of it in a timely manner and refresh it.

Current Behavior

There are two ways to provide MCP tools to ChatClient for use.

The first way: when ChatClient is built

Builder defaultToolCallbacks(ToolCallbackProvider... toolCallbackProviders)

This will call AsyncMcpToolCallbackProvider#getToolcallbacks once. If the MCP tool changes, I must restart my application.

The second type: when a prompt request is made:

ChatClientRequestSpec toolCallbacks(ToolCallbackProvider... toolCallbackProviders);

This will call AsyncMcpToolCallbackProvider#getToolcallback every time a prompt request is made. Even though the MCP tool has not changed.

Context

Add cache to AsyncMcpToolCallbackProvider or MCP Client SDK。 ChatClient getToolCallbacks from cache every request time。

I also submitted an issue to MCP SDK: https://github.com/modelcontextprotocol/java-sdk/issues/456