-
-
Notifications
You must be signed in to change notification settings - Fork 255
feat: add multi-project support to MCP tools #178
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
base: main
Are you sure you want to change the base?
Conversation
Add project-scoped database operations that allow managing multiple projects in the knowledge graph without interference: - list_projects(): List all indexed projects in the database - delete_project(): Delete a specific project while preserving others - wipe_database(): Clear entire database (requires confirmation) - index_repository(): Now uses project-scoped deletion instead of full wipe This enables indexing multiple repositories without losing data from other projects when re-indexing a single repository. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Summary of ChangesHello @PatD42, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the system's ability to manage knowledge graphs for multiple codebases. By introducing project-specific data handling and deletion mechanisms, it ensures that indexing or re-indexing one repository no longer impacts data from other projects, thereby improving data integrity and operational flexibility for users working with diverse codebases. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces multi-project support by adding tools to list and delete projects, and updating the repository indexing logic to be project-scoped. The changes are well-implemented, adding list_projects, delete_project, and wipe_database tools and their corresponding service methods. The index_repository tool is correctly modified to use delete_project, preventing data loss from other projects during re-indexing. I have one suggestion to improve the efficiency and atomicity of the project deletion logic in graph_service.py by combining two separate database queries into a single one.
Update system prompts for Cypher generation to: - Add LIMIT 50 to all listing queries to prevent overwhelming responses - Use count() aggregation for "how many" queries instead of returning all items - Add explicit examples for counting patterns This addresses the issue where asking "how many classes are there?" would return all 478 classes with full details (~23.6k tokens) instead of just the count. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
Addressing Gemini's atomicity concern: Simplified # Before (2 queries, not atomic):
count_result = self.fetch_all("MATCH (n) ... RETURN count(n)")
self._execute_query("MATCH (n) ... DETACH DELETE n")
return node_count
# After (1 query, atomic):
self._execute_query("MATCH (n) ... DETACH DELETE n")Why not use Gemini's suggestion? Gemini proposed The simpler solution: just drop the count. It was only used for logging/cosmetic purposes and isn't essential for correctness. |
Simplify delete_project() to use a single DETACH DELETE query instead of count + delete (two separate queries). This addresses atomicity concerns raised in code review. Changes: - graph_service.py: Remove count query, single atomic delete - mcp/tools.py: Remove deleted_nodes from responses - tests: Update to verify delete_project called instead of clean_database 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Fix empty project name when using relative paths like `.` or `./`.
`Path('.').name` returns empty string, causing broken qualified names.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <[email protected]>
Summary
list_projects()anddelete_project()methods toMemgraphIngestorclass for project-scoped database operationslist_projects,delete_project,wipe_databaseindex_repositoryto use project-scoped deletion instead of wiping entire databaseThis enables indexing multiple repositories without losing data from other projects when re-indexing a single repository.
Changes
graph_service.py
list_projects(): Returns list of all indexed project namesdelete_project(project_name): Deletes all nodes withqualified_namestarting with the project name prefix, preserving other projectsmcp/tools.py
list_projects: MCP tool to list all indexed projectsdelete_project: MCP tool to delete a specific projectwipe_database: MCP tool to clear entire database (requires confirmation flag)index_repository: Updated to usedelete_project()instead ofclean_database(), preserving other projectsTest plan
🤖 Generated with Claude Code