mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-06-08 20:25:19 +02:00
refactor(agents): group MCP tools into shared/tools/mcp/ subpackage
The three MCP siblings (mcp_client/mcp_tool/mcp_tools_cache) served one objective but sat loose at the top of shared/tools. Grouped them into an mcp/ package and dropped the redundant prefix: client.py, tool.py, cache.py. Updated all importers (routes, mcp_tools subagent, e2e fake patch targets, unit test) to the new paths.
This commit is contained in:
parent
8d0090c6a1
commit
c51aca6ccc
9 changed files with 23 additions and 16 deletions
|
|
@ -21,7 +21,7 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
|||
from app.agents.multi_agent_chat.constants import (
|
||||
CONNECTOR_TYPE_TO_CONNECTOR_AGENT_MAPS,
|
||||
)
|
||||
from app.agents.shared.tools.mcp_tool import load_mcp_tools
|
||||
from app.agents.shared.tools.mcp.tool import load_mcp_tools
|
||||
from app.db import SearchSourceConnector
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
"""MCP (Model Context Protocol) integration: client, tool loading, and cache.
|
||||
|
||||
Split by responsibility:
|
||||
- ``client``: the low-level :class:`MCPClient` connection wrapper.
|
||||
- ``tool``: discovery + LangChain tool construction and cache invalidation.
|
||||
- ``cache``: the connector tool-cache refresh helpers.
|
||||
"""
|
||||
|
|
@ -112,7 +112,7 @@ def refresh_mcp_tools_cache_for_connector(
|
|||
when an event loop is available. Neither path raises.
|
||||
"""
|
||||
try:
|
||||
from app.agents.shared.tools.mcp_tool import invalidate_mcp_tools_cache
|
||||
from app.agents.shared.tools.mcp.tool import invalidate_mcp_tools_cache
|
||||
|
||||
invalidate_mcp_tools_cache(search_space_id)
|
||||
except Exception:
|
||||
|
|
@ -133,7 +133,7 @@ def refresh_mcp_tools_cache_for_connector(
|
|||
|
||||
|
||||
async def _run_connector_prefetch(connector_id: int) -> None:
|
||||
from app.agents.shared.tools.mcp_tool import discover_single_mcp_connector
|
||||
from app.agents.shared.tools.mcp.tool import discover_single_mcp_connector
|
||||
|
||||
try:
|
||||
await discover_single_mcp_connector(connector_id)
|
||||
|
|
@ -35,8 +35,8 @@ from sqlalchemy.ext.asyncio import AsyncSession
|
|||
|
||||
from app.agents.shared.middleware.dedup_tool_calls import dedup_key_full_args
|
||||
from app.agents.shared.tools.hitl import request_approval
|
||||
from app.agents.shared.tools.mcp_client import MCPClient
|
||||
from app.agents.shared.tools.mcp_tools_cache import (
|
||||
from app.agents.shared.tools.mcp.client import MCPClient
|
||||
from app.agents.shared.tools.mcp.cache import (
|
||||
CachedMCPTools,
|
||||
read_cached_tools,
|
||||
write_cached_tools,
|
||||
Loading…
Add table
Add a link
Reference in a new issue