feat(tools): prefer relative paths for tool parameters#20484
feat(tools): prefer relative paths for tool parameters#20484aishaneeshah wants to merge 4 commits intomainfrom
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 refines the guidance for tool usage by promoting the preference for relative paths over absolute paths for file and directory operations. This change aims to improve portability and simplify interactions with the workspace, making the tools more intuitive and robust in different environments. The updates are primarily documentation-focused, clarifying expected input for various file system and shell-related tools, and adjusting an internal agent prompt to align with this new preference. 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
|
There was a problem hiding this comment.
Code Review
This pull request consistently updates tool descriptions, documentation, and agent prompts to prefer relative paths for file and directory parameters. The changes are well-aligned with the goals of improving token efficiency, portability, and security. The modifications have been applied across documentation files, TypeScript interfaces, tool definitions, and agent system prompts, ensuring a coherent change. The underlying tool implementations appear to correctly handle both relative and absolute paths by resolving them against the workspace root, so these changes should not introduce any regressions. The updated test snapshots confirm that the new descriptions are correctly generated. Overall, this is a solid and well-executed feature enhancement.
|
Size Change: +318 B (0%) Total Size: 25.7 MB ℹ️ View Unchanged
|
Summary
Updates tool descriptions, TypeScript interfaces, and documentation to prefer relative paths (relative to workspace root) for all file and directory path parameters. This improves token efficiency, environment portability, and security.
Details
grep_search,glob,list_directory,read_file,write_file, andreplacedescriptions ingemini-3.tsto prefer relative paths.run_shell_commanddir_pathdescription indynamic-declaration-helpers.ts.LSToolParamsandWriteFileToolParamsto reflect path preference.packages/core/src/agents/local-executor.tsto mandate relative paths for file operations.docs/tools/file-system.mdanddocs/tools/shell.mddocumentation to reflect these preferences.Related Issues
Related to #19643
How to Validate
npx vitest run packages/corenpx vitest run packages/core/src/tools/definitions/coreToolsModelSnapshots.test.tsnpx vitest run packages/core/src/tools/ls.test.ts packages/core/src/tools/write-file.test.tsPre-Merge Checklist