Skip to content

feat: add compactToolOutputAllowlist setting#25877

Closed
dolphprefect wants to merge 4 commits intogoogle-gemini:mainfrom
dolphprefect:feat/compact-tool-output-allowlist
Closed

feat: add compactToolOutputAllowlist setting#25877
dolphprefect wants to merge 4 commits intogoogle-gemini:mainfrom
dolphprefect:feat/compact-tool-output-allowlist

Conversation

@dolphprefect
Copy link
Copy Markdown

feat: add compactToolOutputAllowlist setting

Introduces a new UI setting compactToolOutputAllowlist (string[]) that extends the built-in compact tool output list. When compactToolOutput is enabled, any tool whose name appears in this list is rendered using the compact DenseToolMessage instead of the full ToolResultDisplay.

This allows external tools (e.g. MCP servers) to opt in to compact rendering by adding their tool names during setup, without requiring changes to the built-in allowlist.

Summary

The existing compactToolOutput setting collapses verbose tool output into a single summary line, but only for a hardcoded set of built-in Gemini tools. MCP server tools — which can have any name and are user-defined — were always rendered verbosely regardless of this setting.

This PR adds a compactToolOutputAllowlist UI setting (string array, default empty) that extends the built-in list at runtime. Any tool name in the allowlist is treated as compact-eligible when compactToolOutput is enabled. MCP server setup scripts can populate this list in settings.json so their tools benefit from compact rendering without requiring upstream code changes.

Details

  • compactToolOutputAllowlist is defined in settingsSchema.ts as an array of strings, not shown in the settings dialog (it's intended for programmatic population by tool setup scripts).
  • isCompactTool() in ToolGroupMessage.tsx gains an optional extraAllowlist parameter (defaults to []) checked alongside the built-in COMPACT_OUTPUT_ALLOWLIST.
  • All call sites in ToolGroupMessage.tsx and useGeminiStream.ts pass the allowlist read from settings. Hook dependency arrays updated accordingly.
  • No behaviour change for existing users — the allowlist defaults to empty.

Related Issues

How to Validate

  1. Add tool names to ~/.gemini/settings.json:
    {
      "ui": {
        "compactToolOutput": true,
        "compactToolOutputAllowlist": ["my_mcp_tool"]
      }
    }
  2. Configure an MCP server that exposes a tool named my_mcp_tool.
  3. Start Gemini CLI and trigger a call to my_mcp_tool.
  4. Confirm the result renders as a single compact line (tool name + summary) rather than the full output block.
  5. Set compactToolOutput: false and confirm the tool reverts to full output (allowlist has no effect when compact mode is off).
  6. Remove the tool name from the allowlist and confirm it reverts to full output.

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

Introduces a new UI setting compactToolOutputAllowlist (string[]) that
extends the built-in compact tool output list. When compactToolOutput is
enabled, any tool whose name appears in this list is rendered using the
compact DenseToolMessage instead of the full ToolResultDisplay.

This allows external tools (e.g. MCP servers) to opt in to compact
rendering by adding their tool names during setup, without requiring
changes to the built-in allowlist.
@dolphprefect dolphprefect requested a review from a team as a code owner April 23, 2026 19:08
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 introduces a flexible mechanism for users to control which tools are rendered in a compact format. By adding a configurable allowlist, users can now enable compact output for custom or external tools, such as those provided by MCP servers, without requiring changes to the core codebase. This improves the UI experience for users with custom tool integrations.

Highlights

  • New Configuration Setting: Introduced compactToolOutputAllowlist in settingsSchema.ts to allow users to specify additional tools for compact rendering.
  • Logic Update: Updated isCompactTool in ToolGroupMessage.tsx to accept an optional allowlist, enabling custom tools (like MCP servers) to be rendered compactly.
  • Integration: Updated all call sites in ToolGroupMessage.tsx and useGeminiStream.ts to pass the new allowlist from settings, ensuring consistent behavior across the UI.
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.

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.

@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 23, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-cli gemini-cli Bot added the priority/p1 Important and should be addressed in the near term. label Apr 23, 2026
Copy link
Copy Markdown
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 a compactToolOutputAllowlist setting to the CLI configuration, allowing users to specify additional tools for compact display. The changes update the settings schema and integrate the allowlist into the ToolGroupMessage component and useGeminiStream hook. Feedback suggests memoizing the allowlist as a Set to optimize lookup performance from O(N) to O(1) within frequently called rendering functions.

Comment thread packages/cli/src/ui/components/messages/ToolGroupMessage.tsx
@dolphprefect
Copy link
Copy Markdown
Author

Closed in favor of the much simpler proposal #25912

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

Labels

priority/p1 Important and should be addressed in the near term.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant