fix: invalidate MCP tool cache on provider update to refresh descriptions#34629
Open
BrianWang1990 wants to merge 2 commits intolanggenius:mainfrom
Open
fix: invalidate MCP tool cache on provider update to refresh descriptions#34629BrianWang1990 wants to merge 2 commits intolanggenius:mainfrom
BrianWang1990 wants to merge 2 commits intolanggenius:mainfrom
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, thehandleUpdatecallback callsonUpdate()after a successfulupdateMCP, which refreshes the provider list viauseAllToolProviders. However, it did not invalidate the individual provider's tool cache (useMCPTools), so the cached tool names and descriptions persisted.The sibling
handleUpdateToolscallback already correctly callsinvalidateMCPTools(detail.id)after updating tools —handleUpdatesimply needed the same invalidation.Fix
Added
invalidateMCPTools(detail.id)in thehandleUpdatecallback (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 —
invalidateMCPToolswas already imported and used elsewhere in the same component.