refactor(core): complete centralization of core tool definitions#18991
Conversation
|
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 the core tool definitions by centralizing them into a single file. This change improves maintainability, reduces redundancy, and ensures consistency across various tools by providing a single source of truth for their schemas and descriptions. The refactoring also addresses potential circular dependency issues and enhances test coverage for tool definitions. Highlights
Changelog
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
|
|
Size Change: +2.69 kB (+0.01%) Total Size: 24.4 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request is a well-executed refactoring that successfully centralizes the core tool definitions into coreTools.ts. This change significantly improves code organization and maintainability by removing duplicated schema definitions from individual tool files. The updates are consistently applied across all affected tools, and the snapshot tests have been updated accordingly, which is great to see. The approach to move tool name constants to prevent circular dependencies is also a solid improvement. Overall, this is a high-quality refactoring with no issues found.
|
|
||
| > gemini-cli-vscode-ide-companion@0.30.0-nightly.20260210.a2174751d check-types | ||
| > tsc --noEmit | ||
|
|
There was a problem hiding this comment.
Looks like this was unintentionally committed. Can we delete it?
| import { zodToJsonSchema } from 'zod-to-json-schema'; | ||
|
|
||
| // ============================================================================ | ||
| // TOOL NAMES |
There was a problem hiding this comment.
I wonder if we should name this file to set the versioning strategy since we may have to do this again with future model generations.
There was a problem hiding this comment.
Maybe also worth a comment about the 2.5 - 3.0 split?
| GetInternalDocsTool.Name, | ||
| 'GetInternalDocs', | ||
| 'Returns the content of Gemini CLI internal documentation files. If no path is provided, returns a list of all available documentation paths.', | ||
| GET_INTERNAL_DOCS_DEFINITION.base.description!, |
There was a problem hiding this comment.
Another place it'd be great to avoid the null suppression.
gundermanc
left a comment
There was a problem hiding this comment.
LGTM though I think preflight.log should be deleted.
Update test snapshot
Add comment in coreTools.ts
- Add 'type' to required parameters for 'ask_user' questions. - Include missing plan mode and documentation tools in ALL_BUILTIN_TOOL_NAMES. - Remove extra examples from 'save_memory' description to match main. - Update snapshots for model definitions.
ed54396 to
b12696d
Compare
Summary
Complete refactor of remaining core tools to use centralized definitions in
coreTools.ts.Details
activate-skill.ts,ask-user.ts,enter-plan-mode.ts,exit-plan-mode.ts,get-internal-docs.ts,memoryTool.ts,read-many-files.ts,web-fetch.ts, andwrite-todos.tsto implementgetSchemaand use centralized definitions.coreToolsModelSnapshots.test.tsto include coverage for all core tools.Related Issues
Related to #18944
Fixes #17958
How to Validate
Run snapshot tests:
npm test -w @google/gemini-cli-core -- src/tools/definitions/coreToolsModelSnapshots.test.tsRun CLI tool tests:
npm test -w @google/gemini-cli -- src/ui/components/messages/ShellToolMessage.test.tsxPre-Merge Checklist