fix: downgrade MCP tool error logs from warning to debug (#8846)
Change the log level for expected MCP tool execution failures (ToolError, McpError) from warning to debug in fastmcp_client.py to match base_client.py. These errors occur when an LLM calls an MCP tool with missing/invalid arguments - they are expected user-facing issues from external MCP servers, not system errors that should trigger production alerts. Fixes #8845 🤖 Generated with [Letta Code](https://letta.com) Co-authored-by: letta-code <248085862+letta-code@users.noreply.github.com> Co-authored-by: datadog-official[bot] <datadog-official[bot]@users.noreply.github.com> Co-authored-by: Kian Jones <11655409+kianjones9@users.noreply.github.com>
This commit is contained in:
committed by
Sarah Wooders
parent
940d648d42
commit
15de765876
@@ -141,9 +141,10 @@ class AsyncFastMCPSSEClient:
|
||||
except Exception as e:
|
||||
# ToolError is raised by fastmcp for input validation errors (e.g., missing required properties)
|
||||
# McpError is raised for other MCP-related errors
|
||||
# Both are expected user-facing errors from MCP tools, log at warning level
|
||||
# Both are expected user-facing issues from external MCP servers
|
||||
# Log at debug level to avoid triggering production alerts for expected failures
|
||||
if e.__class__.__name__ in ("McpError", "ToolError"):
|
||||
logger.warning(f"MCP tool '{tool_name}' execution failed: {str(e)}")
|
||||
logger.debug(f"MCP tool '{tool_name}' execution failed: {str(e)}")
|
||||
raise
|
||||
|
||||
# Parse content from result
|
||||
@@ -297,9 +298,10 @@ class AsyncFastMCPStreamableHTTPClient:
|
||||
except Exception as e:
|
||||
# ToolError is raised by fastmcp for input validation errors (e.g., missing required properties)
|
||||
# McpError is raised for other MCP-related errors
|
||||
# Both are expected user-facing errors from MCP tools, log at warning level
|
||||
# Both are expected user-facing issues from external MCP servers
|
||||
# Log at debug level to avoid triggering production alerts for expected failures
|
||||
if e.__class__.__name__ in ("McpError", "ToolError"):
|
||||
logger.warning(f"MCP tool '{tool_name}' execution failed: {str(e)}")
|
||||
logger.debug(f"MCP tool '{tool_name}' execution failed: {str(e)}")
|
||||
raise
|
||||
|
||||
# Parse content from result
|
||||
|
||||
Reference in New Issue
Block a user