Skip to content

Improve error logging in MCP tool#1353

Open
aydnOktay wants to merge 1 commit intoNousResearch:mainfrom
aydnOktay:improve/mcp-error-logging
Open

Improve error logging in MCP tool#1353
aydnOktay wants to merge 1 commit intoNousResearch:mainfrom
aydnOktay:improve/mcp-error-logging

Conversation

@aydnOktay
Copy link
Contributor

This PR enhances error observability in mcp_tool.py by adding exc_info=True to all error and warning logs, ensuring full stack traces are included for better debugging. The changes upgrade exception handlers from logger.debug to logger.error with exc_info=True for config loading failures and shutdown errors, and add exc_info=True to reconnection failure warnings, connection lost warnings, and all MCP tool call errors (tool calls, list_resources, read_resource, list_prompts, and get_prompt). These improvements provide consistent error logging patterns across the codebase, align with CONTRIBUTING.md guidance, and make it significantly easier to diagnose MCP server connection issues, tool call failures, and other errors during development and production debugging.

- Add exc_info=True to all error/warning logs in mcp_tool.py
- Upgrade exception handlers from logger.debug to logger.error with exc_info=True
- Ensures full stack traces are included in logs for better debugging
- Covers reconnection failures, connection lost warnings, tool call errors, and shutdown errors
- Consistent with error logging patterns in other tools (browser_tool, web_tools, tts_tool)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant