Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a dynamic tool loading system for XtraMCP integration, replacing the previous manual tool registration approach. The new system automatically initializes MCP sessions, fetches available tools, and creates dynamic tool instances that reuse session IDs for efficient execution.
Key changes:
- Implemented
XtraMCPLoaderto dynamically discover and register tools from XtraMCP backend - Created
DynamicToolto handle generic tool execution with session reuse - Added MCP initialization utilities and corresponding tests
- Modified AIClient to use dynamic tool loading instead of static registration
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/services/toolkit/tools/xtramcp/tool.go | Implements DynamicTool with session ID reuse for executing MCP tools |
| internal/services/toolkit/tools/xtramcp/loader.go | Implements XtraMCPLoader for MCP session initialization and dynamic tool discovery |
| internal/services/toolkit/tools/xtragpt/util_test.go | Adds comprehensive tests for MCP initialization and notification workflows |
| internal/services/toolkit/tools/xtragpt/util.go | Provides utility functions for MCP protocol communication |
| internal/services/toolkit/tools/xtragpt/search_papers.go | Contains SearchPapersTool implementation (appears to be legacy code) |
| internal/services/toolkit/client/client.go | Updates AIClient to use XtraMCPLoader for dynamic tool registration |
| internal/api/gin.go | Changes CORS configuration to allow all origins |
| hack/values-dev.yaml | Adds development configuration for namespace and MongoDB settings |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Key Changes:
Previously, we experimented with registering
search_paperstool. It is tedious and not scalable to manually create separate files and extension for each tool. Here, we propose a dynamic loader that initializes connection with the XtraMCP and dynamically load tools exposed by XtraMCP.XtraMCPLoaderDynamicToolOverall Workflow
↓
↓
↓
↓
↓
See result below from the dynamic loading:
Issues