SurfSense/surfsense_backend/app/agents/new_chat/tools
CREDO23 704d1bf18f refactor(mcp): per-connector cache refresh on lifecycle events
Collapse the invalidate + warmup pair into a single
refresh_mcp_tools_cache_for_connector(connector_id, search_space_id)
helper and scope live discovery to the one connector that changed
instead of the whole search space.

- new mcp_tool.discover_single_mcp_connector: load one connector,
  refresh OAuth if needed, force live MCP discovery so its cached_tools
  row is rewritten; returned wrappers are discarded since the in-process
  LRU is rebuilt lazily on the next user query
- mcp_tools_cache.refresh_mcp_tools_cache_for_connector: synchronously
  evicts the per-space LRU (LRU keys cannot scope finer) and schedules
  the per-connector prefetch via loop.create_task
- routes (OAuth callback, MCP POST, MCP PUT) collapse their two
  back-to-back calls into a single refresh call; DELETE handlers keep
  using bare invalidate_mcp_tools_cache (nothing to prefetch)

No new automated tests: the new functions are I/O glue (DB + network)
where mocked unit tests would test implementation rather than behavior.
The existing 9 unit tests for the cached_tools data shape are unchanged.
2026-05-20 17:43:27 +02:00
..
confluence feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
discord feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
dropbox feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
gmail feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
google_calendar feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
google_drive feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
jira feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
linear feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
luma feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
notion feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
onedrive feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
teams feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
__init__.py refactor: rename and consolidate memory tools to update_memory 2026-04-08 23:29:26 +05:30
connected_accounts.py feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
generate_image.py feat: fixed vision/image provider specific errors and fixed podcast/video streaming 2026-05-02 19:18:53 -07:00
hitl.py fix: fixed composio issues 2026-05-02 21:16:03 -07:00
invalid_tool.py chore: cleaned comments slop 2026-04-28 23:52:37 -07:00
knowledge_base.py feat: add Dropbox integration support with configuration and connector updates 2026-03-30 22:16:41 +05:30
mcp_client.py chore: linting 2026-04-27 14:04:50 -07:00
mcp_tool.py refactor(mcp): per-connector cache refresh on lifecycle events 2026-05-20 17:43:27 +02:00
mcp_tools_cache.py refactor(mcp): per-connector cache refresh on lifecycle events 2026-05-20 17:43:27 +02:00
podcast.py feat: updated file management for main agent 2026-04-28 04:32:52 -07:00
registry.py feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
report.py feat: made agent file sytem optimized 2026-03-28 16:39:46 -07:00
resume.py fix: adjust spacing in resume template for highlights 2026-04-22 19:24:30 +05:30
scrape_webpage.py feat: update YouTube transcript fetching to select primary language transcripts 2026-02-06 14:02:46 -08:00
search_surfsense_docs.py feat: implement agent caches and fix invalid prompt cache configs 2026-05-03 06:03:40 -07:00
tool_response.py chore: linting 2026-04-27 14:04:50 -07:00
update_memory.py fix: handle empty response in forced rewrite function 2026-05-04 12:18:09 +05:30
video_presentation.py feat: updated file management for main agent 2026-04-28 04:32:52 -07:00
web_search.py chore: ran linting 2026-03-17 04:40:46 +05:30