Skip to content

Conversation

@imranq2
Copy link

@imranq2 imranq2 commented Nov 23, 2025

This PR removes the caching mechanism for MCP (Model Configuration Protocol) metadata, transitioning to a strategy where tool metadata is fetched fresh from the MCP server on every request. The refactoring removes the McpToolsMetadataExpiringCache class entirely and updates all dependent components to eliminate cache-related logic.

Deleted the entire mcp_tools_expiring_cache.py file containing the caching implementation
Updated MultiServerMCPClientWithCaching to always load fresh metadata instead of using cached data
Removed cache dependencies from MCPToolProvider and the dependency injection container
Simplified the get_tools method to directly load and convert tools without cache management

Copilot AI review requested due to automatic review settings November 23, 2025 08:42
Copilot finished reviewing on behalf of imranq2 November 23, 2025 08:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the caching mechanism for MCP (Model Configuration Protocol) metadata, transitioning to a strategy where tool metadata is fetched fresh from the MCP server on every request. The refactoring removes the McpToolsMetadataExpiringCache class entirely and updates all dependent components to eliminate cache-related logic.

  • Deleted the entire mcp_tools_expiring_cache.py file containing the caching implementation
  • Updated MultiServerMCPClientWithCaching to always load fresh metadata instead of using cached data
  • Removed cache dependencies from MCPToolProvider and the dependency injection container
  • Simplified the get_tools method to directly load and convert tools without cache management

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
language_model_gateway/gateway/utilities/cache/mcp_tools_expiring_cache.py Complete removal of the MCP tools metadata caching implementation
language_model_gateway/gateway/tools/mcp_tool_provider.py Removed cache parameter from constructor and updated initialization logic
language_model_gateway/gateway/langchain_overrides/multiserver_mcp_client_with_caching.py Refactored to always fetch fresh metadata; removed all caching logic from get_tools and related methods
language_model_gateway/container/container_factory.py Removed singleton registration for McpToolsMetadataExpiringCache and removed cache injection into MCPToolProvider

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

*,
tools: list[Tool],
session: ClientSession | None = None,
session: ClientSession | None,
Copy link

Copilot AI Nov 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The removal of the default value (= None) from the session parameter changes the method signature. While this doesn't break existing code (since all current callers explicitly pass session=None), it does change the API by requiring callers to explicitly provide a value for session instead of being able to omit it. Consider whether this is intentional or if the default value should be preserved for backward compatibility.

Suggested change
session: ClientSession | None,
session: ClientSession | None = None,

Copilot uses AI. Check for mistakes.
@imranq2 imranq2 merged commit 2909cec into main Nov 23, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants