refactor(core): modularize tool definitions by model family#19269
refactor(core): modularize tool definitions by model family#19269aishaneeshah merged 13 commits intomainfrom
Conversation
|
Hi there! Thank you for your contribution to Gemini CLI. To improve our contribution process and better track changes, we now require all pull requests to be associated with an existing issue, as announced in our recent discussion and as detailed in our CONTRIBUTING.md. This pull request is being closed because it is not currently linked to an issue. Once you have updated the description of this PR to link an issue (e.g., by adding How to link an issue: Thank you for your understanding and for being a part of our community! |
|
Hi @aishaneeshah, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this. We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines. Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed. Thank you for your understanding and for being a part of our community! |
Summary of ChangesHello @aishaneeshah, 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 refactors how core tool definitions are managed, transitioning to a modular system that supports model-family specific optimizations. The change enables more precise control over tool capabilities for different models, such as Gemini 3, by providing distinct, explicit toolsets rather than relying on a base-and-override mechanism. This architectural improvement enhances maintainability, readability, and future extensibility of the tool definitions. Highlights
Changelog
Activity
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.
Code Review
This pull request introduces a significant and well-executed refactoring of the core tool definitions. By modularizing the definitions into discrete sets for different model families (default-legacy and gemini-3), the changes greatly improve the structure and prepare the codebase for future model-specific optimizations. The introduction of base-declarations.ts for tool names, dynamic-declaration-helpers.ts for state-dependent logic, and modelFamilyService.ts for resolving tool families creates a clean and maintainable architecture. The legacy exports in coreTools.ts provide a solid backward-compatibility layer. The code is consistent, and the new structure is explicit, which will make it easier to manage and audit tool capabilities for different models. I did not find any issues of high or critical severity.
|
Thank you for linking an issue! This pull request has been automatically reopened. |
|
Size Change: +36.7 kB (+0.15%) Total Size: 24.5 MB
ℹ️ View Unchanged
|
| @@ -0,0 +1,165 @@ | |||
| /** | |||
| * @license | |||
| * Copyright 2025 Google LLC | |||
| @@ -0,0 +1,165 @@ | |||
| /** | |||
| * @license | |||
There was a problem hiding this comment.
file name nit: consider naming the file based on its content. e.g.: "tool-descriptions.ts"
| @@ -0,0 +1,681 @@ | |||
| /** | |||
| * @license | |||
| * Copyright 2025 Google LLC | |||
| @@ -0,0 +1,681 @@ | |||
| /** | |||
There was a problem hiding this comment.
filename nit: can we name the file based on content? Maybe gemini-3-tool-schemas.ts?
Summary
Modularizes core tool definitions to support model-family specific optimizations (e.g., Gemini 3 vs Legacy). This refactor moves from a "base + override" model to a "discrete set" model, ensuring that model capabilities are intentionally managed.
Details
ModelFamilyService.tsto map model IDs to families (Legacy, Gemini 3).default-legacy.tsandgemini-3.tswhich contain the full description and schema for every core tool.base-declarations(Identity registry) anddynamic-declaration-helpers(Logic) to prevent circular dependencies.Related Issues
Fixes #17958
How to Validate
npm test -w @google/gemini-cli-core -- src/tools/definitions/coreToolsModelSnapshots.test.tsnpm test -w @google/gemini-cli-core -- src/tools/buildandtypecheckpass:Pre-Merge Checklist