Skip to content

Conversation

@luxannaxul
Copy link

Hi maintainers,

This PR improves the MCP server tool set in codebase_rag/mcp/tools.py in two areas:

Optional semantic_search tool registration
Adds a semantic search MCP tool that is only registered when semantic dependencies are installed (checked via has_semantic_dependencies()). This avoids exposing semantic_search in environments where it would otherwise return empty results. When unavailable, the server logs a clear message pointing to uv sync --extra semantic.

Non-destructive repository updates
Introduces a new MCP tool, update_repository, which runs GraphUpdater without clearing the database first. This complements the existing index_repository tool (which still performs a full wipe + reindex) and makes incremental updates available via MCP as well.

Thanks for reviewing!

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @luxannaxul, 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 MCP server's capabilities by integrating an optional semantic search tool for more intuitive code exploration and introducing a non-destructive repository update mechanism. These changes provide greater flexibility in managing and querying the codebase's knowledge graph, allowing for both semantic-based queries and efficient incremental updates without requiring a full re-indexing of the repository.

Highlights

  • Optional Semantic Search Tool: A new semantic_search tool has been added, which is only registered and available if the necessary semantic dependencies are installed. If these dependencies are missing, the server logs a message guiding users on how to install them.
  • Non-Destructive Repository Update: A new update_repository tool is introduced. This tool allows for incremental updates to the Memgraph knowledge graph without first clearing existing data, providing a less disruptive alternative to the index_repository tool.
  • Tool Description Clarifications: The descriptions for index_repository and query_code_graph have been updated to clarify their usage, particularly in relation to the new semantic_search tool, advising when to prefer one over the other.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 two valuable improvements to the MCP server tools. The optional registration of the semantic_search tool based on dependency availability is a clean solution, and the new non-destructive update_repository tool is a great feature for incremental updates. The code is well-structured, and the added warnings for destructive operations are a thoughtful touch. I've left a couple of minor comments regarding a typo and a docstring inconsistency. Overall, this is a solid contribution.

luxannaxul and others added 2 commits December 23, 2025 18:48
typo

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
overlooked consistency of naming

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@vitali87
Copy link
Owner

Hey, thanks for the contribution! The feature itself is really useful - having a non-destructive update_repository option and conditional semantic_search registration is exactly what we need. Nice thinking on the incremental updates.

A few things to address before we can merge:

1. Coding Standards - String Centralization

The project follows a strict "no hardcoded strings" policy. Tool names, descriptions, and log messages need to live in their respective modules:

  • Tool names → constants.py (add to MCPToolName enum)
  • Descriptions → tools/tool_descriptions.py (add to MCP_TOOLS dict)
  • Log messages → logs.py

This ensures the new tools will also show up in the auto-generated README (we have a dynamic generator that pulls from these sources).

2. Input Schema Structure

The existing tools use MCPInputSchema and MCPInputSchemaProperty TypedDicts from types_defs.py. Would be great to keep that pattern consistent rather than inline dicts.

3. No Docstrings

Per our coding standards, we don't use docstrings - code should be self-documenting. Please remove all the docstrings from the new methods (update_repository, semantic_search, etc.). The tool descriptions in tool_descriptions.py serve as the documentation for MCP tools.

4. Tool Descriptions Tone

The warning about index_repository clearing data is important, but the current phrasing is a bit intense:

"NEVER USE THIS EXCEPT YOU ARE DIRECTLY ASKED TO, IT CLEANS ALL EXISTING EMBEDDINGS!!!"

Could we tone this down to something like:

"WARNING: Clears the entire database including embeddings. Use update_repository for incremental updates. Only use when explicitly requested."

5. Minor Grammar

A few spots have "except you" which should be "unless you" (e.g., "except you know exact names" → "unless you know exact names").


Would you mind making these adjustments? Happy to help if you have questions about where things should go. The feature is solid, just needs to align with how the rest of the codebase is structured.

Copy link
Owner

@vitali87 vitali87 left a comment

Choose a reason for hiding this comment

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

See my comment above for details on what needs to be addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants