diff --git a/apps/onboarding/mcp.py b/apps/onboarding/mcp.py index 8438fa0..a6c56ab 100644 --- a/apps/onboarding/mcp.py +++ b/apps/onboarding/mcp.py @@ -52,9 +52,13 @@ class MCPRouter: if method_name: method = getattr(self, method_name, None) if method: - result = await method(arguments) - logger.info('MCP tool call completed: tool=%s result=%s', name, result) - return result + try: + result = await method(arguments) + logger.info('MCP tool call completed: tool=%s result=%s', name, result) + return result + except Exception as exc: + logger.exception('MCP tool call failed: tool=%s error=%s', name, exc) + return {'error': f'Tool {name} failed: {exc}'} logger.warning('MCP tool call rejected: unknown tool=%s', name) return {'error': f'Tool {name} not found'}