Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 24, 2025

Summary

This PR addresses issue #6189 where users were experiencing consistent failures when using the Memory Bank MCP tool, causing Roo to stop working.

Changes

1. Retry Logic with Exponential Backoff

  • Added automatic retry mechanism (up to 3 attempts) for transient MCP tool failures
  • Implements exponential backoff with delays of 1s, 2s, and 4s between retries
  • Helps handle temporary network issues or server hiccups

2. Enhanced Error Handling

  • Added comprehensive error categorization (timeout, connection, server errors)
  • Improved error messages to be more user-friendly and actionable
  • Added server connection status checks before attempting tool calls

3. Parameter Validation

  • Added validation for MCP tool parameters before execution
  • Trims whitespace from string parameters to prevent common input errors
  • Provides clear error messages for invalid parameters

4. Better User Experience

  • Added localized error messages for internationalization support
  • Error messages now provide specific guidance on how to resolve issues
  • Shows available tools when a requested tool is not found

Testing

  • Updated existing tests to match new error message formats
  • All tests pass successfully
  • Manually tested retry logic with simulated failures

Impact

These changes should significantly improve the reliability of MCP tool execution and provide users with clearer guidance when issues occur, preventing the "Roo stops working" scenario described in the issue.

Fixes #6189


Important

Enhances MCP tool error handling with retry logic, improved messages, and parameter validation, significantly improving reliability and user guidance.

  • Behavior:
    • Adds retry logic with exponential backoff in executeToolAndProcessResult() in useMcpToolTool.ts for transient MCP tool failures.
    • Enhances error handling in callTool() in McpHub.ts with detailed error categorization and improved messages.
    • Validates MCP tool parameters in validateParams() in useMcpToolTool.ts, trimming whitespace and checking JSON format.
  • User Experience:
    • Localized error messages added in mcp.json for better internationalization support.
    • Error messages now guide users on resolving issues and show available tools if a requested tool is not found.
  • Testing:
    • Updates tests in useMcpToolTool.spec.ts and McpHub.spec.ts to match new error message formats and retry logic.
    • Ensures all tests pass and manually tests retry logic with simulated failures.

This description was created by Ellipsis for 1a1fc31. You can customize this summary. It will automatically update as commits are pushed.

…ages

- Add retry logic with exponential backoff (up to 3 retries) for transient failures
- Implement comprehensive error handling with user-friendly messages
- Add parameter validation before MCP tool execution
- Enhance error messages to provide actionable guidance
- Check server connection status before attempting tool calls
- Add localized error messages for better user experience

Fixes #6189
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 24, 2025 23:11
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Jul 24, 2025
if (!serverName) {
cline.consecutiveMistakeCount++
cline.recordToolError("use_mcp_tool")
await cline.say("error", "Server name cannot be empty or contain only whitespace")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the translation function (t) for user‐facing error messages instead of hardcoding strings (e.g. 'Server name cannot be empty or contain only whitespace'). This will ensure consistency with i18n practices.

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

if (!toolName) {
cline.consecutiveMistakeCount++
cline.recordToolError("use_mcp_tool")
await cline.say("error", "Tool name cannot be empty or contain only whitespace")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, use i18n for the tool name error message rather than a literal string.

Suggested change
await cline.say("error", "Tool name cannot be empty or contain only whitespace")
await cline.say("error", t("tool_name_empty_error"))

This comment was generated because it violated a code review rule: irule_C0ez7Rji6ANcGkkX.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 24, 2025
@daniel-lxs
Copy link
Member

Not an issue

@daniel-lxs daniel-lxs closed this Jul 25, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 25, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Difficulty using Memory_bank MCP

4 participants