fix(mcp): remove dead toolset cache stubs, log invalidation failures, align schema updated_at defaults

This commit is contained in:
Ishaan Jaffer 2026-03-23 14:01:25 -07:00
parent 2a07c3e90d
commit 1cff05e87d
3 changed files with 6 additions and 10 deletions

View file

@ -336,7 +336,7 @@ model LiteLLM_MCPToolsetTable {
tools Json @default("[]") // [{server_id: string, tool_name: string}]
created_at DateTime @default(now())
created_by String?
updated_at DateTime @updatedAt
updated_at DateTime @default(now()) @updatedAt
updated_by String?
}

View file

@ -182,12 +182,6 @@ class MCPServerManager:
}
"""
# Toolset caches are now stored in user_api_key_cache (Redis-backed DualCache
# in production) so entries are shared across workers. These attributes are
# kept as empty stubs so existing callers don't AttributeError during tests.
self._toolset_perm_cache: Dict[str, Tuple[Dict[str, List[str]], float]] = {}
self._toolset_name_cache: Dict[str, Tuple[Optional[Any], float]] = {}
def get_registry(self) -> Dict[str, MCPServer]:
"""
Get the registered MCP Servers from the registry and union with the config MCP Servers
@ -885,8 +879,10 @@ class MCPServerManager:
]
for k in keys_to_remove:
cache_dict.pop(k, None)
except Exception:
pass
except Exception as e:
verbose_logger.warning(
f"invalidate_toolset_cache: failed to evict in-memory entries: {e}"
)
async def get_toolset_by_name_cached(
self,

View file

@ -340,7 +340,7 @@ model LiteLLM_MCPToolsetTable {
tools Json @default("[]") // [{server_id: string, tool_name: string}]
created_at DateTime @default(now())
created_by String?
updated_at DateTime @updatedAt
updated_at DateTime @default(now()) @updatedAt
updated_by String?
}