Skip to content

fix: invalidate MCP tool cache on provider update to refresh descriptions#34629

Open
BrianWang1990 wants to merge 2 commits intolanggenius:mainfrom
BrianWang1990:fix/mcp-tool-description-cache-invalidation
Open

fix: invalidate MCP tool cache on provider update to refresh descriptions#34629
BrianWang1990 wants to merge 2 commits intolanggenius:mainfrom
BrianWang1990:fix/mcp-tool-description-cache-invalidation

Conversation

@BrianWang1990
Copy link
Copy Markdown
Contributor

Summary

Fixes #31372

When updating an MCP provider configuration through the Studio UI (e.g., changing the server URL via MCPModal), the per-provider tool list cache (useMCPTools(providerID)) was not invalidated. This caused tool descriptions to remain stale even after the provider config was successfully updated.

Root Cause

In web/app/components/tools/mcp/detail/content.tsx, the handleUpdate callback calls onUpdate() after a successful updateMCP, which refreshes the provider list via useAllToolProviders. However, it did not invalidate the individual provider's tool cache (useMCPTools), so the cached tool names and descriptions persisted.

The sibling handleUpdateTools callback already correctly calls invalidateMCPTools(detail.id) after updating tools — handleUpdate simply needed the same invalidation.

Fix

Added invalidateMCPTools(detail.id) in the handleUpdate callback (and its dependency array) to force tool descriptions to refresh when the provider configuration changes.

This is a minimal one-line change with no side effects — invalidateMCPTools was already imported and used elsewhere in the same component.

…ions

When updating an MCP provider configuration (e.g., server URL change),
the per-provider tool list cache (useMCPTools) was not invalidated,
causing stale tool descriptions to persist in the Studio UI.

Added invalidateMCPTools(detail.id) call in handleUpdate callback
to force tool descriptions to refresh after provider config changes.

Closes langgenius#31372
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 7, 2026
@github-actions github-actions bot added the web This relates to changes on the web. label Apr 7, 2026
@dosubot dosubot bot added the javascript Pull requests that update javascript code label Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code size:XS This PR changes 0-9 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

1 participant