-
Notifications
You must be signed in to change notification settings - Fork 33
(fix): fix mcp tools loading #223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdded console.log debugging statements across three files to output tools information during initialization and model invocation. In mcp.ts, parseTools is now awaited in initializeConnections to ensure completion before proceeding. No changes to control flow logic or public interfaces. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
packages/agent/src/agents/graphs/sub-graph/task-executor.graph.ts (1)
117-117: Remove debugging console.log or replace with logger.This console.log statement appears to be a debugging artifact from troubleshooting the MCP tools loading issue. Since the file already imports and uses
loggerthroughout, either remove this line or replace it with a proper log statement if this information is needed for operational visibility.Apply this diff to remove the debugging statement:
- console.log(this.toolsList.length);Or replace with proper logging if needed:
- console.log(this.toolsList.length); + logger.debug(`[Executor] Tools available: ${this.toolsList.length}`);packages/agent/src/agents/graphs/core-graph/agent.graph.ts (1)
151-151: Remove duplicate debugging console.log statements or replace with logger.These console.log statements appear to be debugging artifacts. The same tools list length is logged twice—once after initialization (line 151) and again at the start of workflow building (line 406). Since the file already imports and uses
loggerthroughout, either remove these lines or consolidate into a single proper log statement if operational visibility is needed.Apply this diff to remove the debugging statements:
- console.log(`Tools list length: ${this.toolsList.length}`); // Initialize RAG agent if enabled- console.log(`Tools list length: ${this.toolsList.length}`); const memory = new MemoryGraph(Or replace with proper logging if needed:
- console.log(`Tools list length: ${this.toolsList.length}`); + logger.info(`[Agent] Initialized ${this.toolsList.length} tools`);- console.log(`Tools list length: ${this.toolsList.length}`); + logger.debug(`[Agent] Building workflow with ${this.toolsList.length} tools`);Also applies to: 406-406
packages/agent/src/services/mcp/src/mcp.ts (1)
64-64: Remove debugging console.log or replace with existing logger.This console.log statement appears to be a debugging artifact. Since the file already imports and uses
loggerthroughout, and line 65 already logs the tools count, this additional console.log is redundant.Apply this diff to remove the debugging statement:
const tools = await this.client.getTools(); this.tools = tools; - console.log(tools); logger.info(`Parsed ${tools.length} tools from MCP servers`);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
packages/agent/src/agents/graphs/core-graph/agent.graph.ts(2 hunks)packages/agent/src/agents/graphs/sub-graph/task-executor.graph.ts(1 hunks)packages/agent/src/services/mcp/src/mcp.ts(2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Build Check
- GitHub Check: validate-build
🔇 Additional comments (1)
packages/agent/src/services/mcp/src/mcp.ts (1)
82-82: Excellent fix for the race condition.Adding
awaitensures thatparseTools()completes and populatesthis.toolsbeforeinitializeConnections()returns. This was the root cause of the tools loading issue—without the await, the tools array could be empty when accessed downstream.
Summary by CodeRabbit