Repository navigation
feat(browser): dynamically discover read-only tools - #23805
Conversation
Summary of ChangesHello, 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 refactors the browser agent's tool policy management to dynamically identify read-only tools using annotations. This change streamlines the configuration process, reduces maintenance overhead by eliminating hardcoded lists, and ensures that existing visual tools continue to function as expected, ultimately improving the agent's flexibility and maintainability. 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. Footnotes
|
|
Size Change: +111 B (0%) Total Size: 26.3 MB
βΉοΈ View Unchanged
|
There was a problem hiding this comment.
Code Review
This pull request refactors the identification of read-only tools within the browser agent. It introduces a mechanism to dynamically discover tools marked with an "annotations.readOnlyHint" property, replacing a previously hardcoded list. An additional allowlist is maintained for other tools that should also be treated as read-only. The test suite has been updated to reflect this new annotation approach for the "list_pages" tool. There is no specific feedback to provide on the review comments as none were submitted.

Summary
Dynamically discover read-only tools using MCP annotations to assign ALLOW policies, rather than hardcoding them. This reduces noise and improves configurability for browser agent tool policies while maintaining backward compatibility for previously allowlisted visual tools.
Details
createBrowserAgentDefinitioninbrowserAgentFactory.tsto inspect tool annotations for thereadOnlyHintflag defined in chrome devtool mcp so that we can dynamically generatesALLOWrules for these read-only tools.Related Issues
Closes #23792
Pre-Merge Checklist