Log MCP tool loading outcome (fetching, loaded names, or failure with traceback)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-18 12:16:22 +02:00
parent fa090412d2
commit 3932e44495

View File

@@ -307,14 +307,18 @@ class AIService:
return self._mcp_tool_schemas or [] return self._mcp_tool_schemas or []
self._mcp_tools_fetched = True self._mcp_tools_fetched = True
if self.config.image_understand is None: if self.config.image_understand is None:
log.info("MCP tools: image_understand not configured, skipping")
self._mcp_tool_schemas = [] self._mcp_tool_schemas = []
return [] return []
log.info("MCP tools: fetching tool list from %s", self.config.image_understand.command)
try: try:
async with MinimaxImageUnderstandClient(self.config.image_understand) as mcp_client: async with MinimaxImageUnderstandClient(self.config.image_understand) as mcp_client:
raw = await mcp_client.list_tools() raw = await mcp_client.list_tools()
self._mcp_tool_schemas = mcp_tools_to_openai_schemas(raw) self._mcp_tool_schemas = mcp_tools_to_openai_schemas(raw)
names = [s["function"]["name"] for s in self._mcp_tool_schemas]
log.info("MCP tools: loaded %d tool(s): %s", len(names), ", ".join(names) or "(none)")
except Exception: except Exception:
log.warning("Failed to fetch MCP tool schemas; MiniMax tools will be unavailable") log.warning("MCP tools: failed to load, MiniMax tools will be unavailable", exc_info=True)
self._mcp_tool_schemas = [] self._mcp_tool_schemas = []
return self._mcp_tool_schemas or [] return self._mcp_tool_schemas or []