Skip to content

fix(patch): cherry-pick 931e668 to release/v0.33.0-preview.4-pr-21425 [CONFLICTS]#21478

Merged
abhipatel12 merged 4 commits intorelease/v0.33.0-preview.4-pr-21425from
hotfix/v0.33.0-preview.4/0.33.0-preview.5/preview/cherry-pick-931e668/pr-21425
Mar 7, 2026
Merged

fix(patch): cherry-pick 931e668 to release/v0.33.0-preview.4-pr-21425 [CONFLICTS]#21478
abhipatel12 merged 4 commits intorelease/v0.33.0-preview.4-pr-21425from
hotfix/v0.33.0-preview.4/0.33.0-preview.5/preview/cherry-pick-931e668/pr-21425

Conversation

@gemini-cli-robot
Copy link
Collaborator

This PR automatically cherry-picks commit 931e668 to patch version v0.33.0-preview.4 in the preview release to create version 0.33.0-preview.5.

⚠️ Merge Conflicts Detected

This cherry-pick resulted in merge conflicts that need manual resolution.

🔧 Next Steps:

  1. Review the conflicts: Check out this branch and review the conflict markers
  2. Resolve conflicts: Edit the affected files to resolve the conflicts
  3. Test the changes: Ensure the patch works correctly after resolution
  4. Update this PR: Push your conflict resolution

📋 Files with conflicts:

The commit has been created with conflict markers for easier manual resolution.

🚨 Important:

  • Do not merge this PR until conflicts are resolved
  • The automated patch release will trigger once this PR is merged

# Conflicts:
#	integration-tests/policy-headless.test.ts
#	packages/core/src/tools/mcp-tool.test.ts
#	packages/core/src/tools/mcp-tool.ts
#	packages/core/src/tools/tool-registry.test.ts
@gemini-code-assist
Copy link
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 addresses a significant refactoring of how Multi-Cloud Platform (MCP) tools are named and managed within the system. The changes introduce a standardized naming convention for MCP tools and update the policy enforcement mechanisms to leverage this new structure, enhancing the reliability and clarity of tool identification and access control. This is an automated cherry-pick with detected merge conflicts that require manual resolution.

Highlights

  • MCP Tool Naming Convention: Standardized MCP (Multi-Cloud Platform) tool names to a mcp_serverName_toolName format, replacing the previous serverName__toolName convention for improved clarity and consistency.
  • Policy Engine Refactoring: Updated the policy engine to explicitly support the new MCP tool naming convention and introduced an mcpName property in policy rules for more robust and precise matching of MCP tools and servers.
  • Headless Mode Policy Testing: Added new integration tests specifically for the policy engine's behavior in headless mode, verifying how tool execution is allowed or denied based on configured policies.
  • Internal Tool Management: Refactored internal components like mcp-tool.ts and tool-registry.ts to align with the new naming scheme, including new utility functions for parsing and formatting MCP tool names and improved metadata handling.
Changelog
  • integration-tests/extensions-reload.test.ts
    • Updated expected output strings to reflect the new MCP tool naming convention.
  • integration-tests/policy-headless.test.ts
    • Added new integration tests for policy engine behavior in headless mode, covering various allow/deny scenarios for tool execution.
  • packages/cli/src/config/policy-engine.integration.test.ts
    • Updated MCP tool names in policy integration tests to use the new mcp_ prefix.
  • packages/core/src/agents/local-executor.test.ts
    • Modified the generation of qualified MCP tool names to use the new mcp_ prefix and removed the old separator import.
  • packages/core/src/core/snapshots/prompts.test.ts.snap
    • Updated snapshot tests to reflect the new mcp_ prefixed MCP tool names in generated prompts.
  • packages/core/src/core/loggingContentGenerator.test.ts
    • Updated expected MCP tool names in context breakdown estimation tests and clarified MCP tool classification logic.
  • packages/core/src/core/prompts.test.ts
    • Adjusted prompt assertions to expect the new mcp_ prefixed tool names.
  • packages/core/src/policy/config.test.ts
    • Modified policy rule matching logic to use the new mcpName property and updated tool names to the mcp_ prefix.
  • packages/core/src/policy/config.ts
    • Implemented the new MCP_TOOL_PREFIX and mcpName property for generating policy rules related to MCP servers.
  • packages/core/src/policy/policy-engine.test.ts
    • Updated numerous test cases to align with the new mcp_ prefix and mcpName property in policy rules, and refined getExcludedTools testing.
  • packages/core/src/policy/policy-engine.ts
    • Refactored matchesWildcard to use the mcp_ prefix, added strict mcpName enforcement in ruleMatches, and updated check and getExcludedTools methods for robust MCP tool identification and static exclusion calculation.
  • packages/core/src/policy/toml-loader.test.ts
    • Updated expected MCP tool names and policy rule structures in TOML policy loading tests.
  • packages/core/src/policy/toml-loader.ts
    • Introduced a warning for deprecated __ syntax in MCP tool names, and updated policy rule generation to use formatMcpToolName and the mcpName property.
  • packages/core/src/policy/types.ts
    • Added mcpName?: string; to the PolicyRule and SafetyCheckerRule interfaces.
  • packages/core/src/prompts/promptProvider.test.ts
    • Updated expected MCP tool names in prompt content for consistency.
  • packages/core/src/tools/mcp-tool.test.ts
    • Added tests for formatMcpToolName, updated generateValidName to enforce the mcp_ prefix, and adjusted DiscoveredMCPTool constructor and qualified name expectations.
  • packages/core/src/tools/mcp-tool.ts
    • Defined new MCP_QUALIFIED_NAME_SEPARATOR = '_' and MCP_TOOL_PREFIX = 'mcp_', introduced isMcpToolName, parseMcpToolName, formatMcpToolName functions, and added McpToolAnnotation interface and type guard.
  • packages/core/src/tools/tool-registry.test.ts
    • Updated expectations for MCP tool names in various registry methods to reflect the new mcp_ prefixed format.
  • packages/core/src/tools/tool-registry.ts
    • Modified buildToolMetadata to consistently include _serverName for DiscoveredMCPTool instances.
Activity
  • This pull request was automatically created as a cherry-pick from commit 931e668b4789c9cf77733f04f460d759bc5ed14f to the release/v0.33.0-preview.4-pr-21425 branch.
  • Merge conflicts were detected during the automated cherry-pick process and require manual resolution.
  • The author, gemini-cli-robot, has provided instructions for resolving the conflicts, testing the changes, and updating the PR.
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.

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

  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.

Copy link
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 significant and valuable refactoring to standardize the naming convention for MCP tools to a fully qualified name (FQN) format, like mcp_server_tool. This change improves the robustness and security of the policy engine by making tool identification more explicit and less prone to spoofing. The updates across the test suite and core logic appear consistent with this goal.

However, a critical issue is that several files (packages/core/src/tools/mcp-tool.ts, packages/core/src/tools/mcp-tool.test.ts, and packages/core/src/tools/tool-registry.test.ts) contain unresolved merge conflict markers. These must be resolved before the PR can be merged, as they will cause the build to fail.

Note: Security Review did not run due to the size of the PR.

Comment on lines +11 to +22
<<<<<<< HEAD
import { DiscoveredMCPTool, generateValidName } from './mcp-tool.js'; // Added getStringifiedResultForDisplay
import type { ToolResult } from './tools.js';
import { ToolConfirmationOutcome } from './tools.js'; // Added ToolConfirmationOutcome
=======
import {
DiscoveredMCPTool,
generateValidName,
formatMcpToolName,
} from './mcp-tool.js'; // Added getStringifiedResultForDisplay
import { ToolConfirmationOutcome, type ToolResult } from './tools.js';
>>>>>>> 931e668b4 (refactor(core): standardize MCP tool naming to mcp_ FQN format (#21425))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This test file has unresolved merge conflict markers in the import statements. This must be fixed for the tests to compile and run. Please merge the imports to include formatMcpToolName and the ToolResult type correctly.

import {
  DiscoveredMCPTool,
  generateValidName,
  formatMcpToolName,
} from './mcp-tool.js'; // Added getStringifiedResultForDisplay
import { ToolConfirmationOutcome, type ToolResult } from './tools.js';

Comment on lines +8 to +18
<<<<<<< HEAD
import type {
ToolCallConfirmationDetails,
ToolInvocation,
ToolMcpConfirmationDetails,
ToolResult,
PolicyUpdateOptions,
} from './tools.js';
=======
import { debugLogger } from '../utils/debugLogger.js';
>>>>>>> 931e668b4 (refactor(core): standardize MCP tool naming to mcp_ FQN format (#21425))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This file contains unresolved merge conflict markers. This is a critical issue that will prevent the code from compiling. Please resolve the conflict by merging the imports correctly. It appears both the type imports from ./tools.js and the debugLogger import are needed.

import type {
  ToolCallConfirmationDetails,
  ToolInvocation,
  ToolMcpConfirmationDetails,
  ToolResult,
  PolicyUpdateOptions,
} from './tools.js';
import { debugLogger } from '../utils/debugLogger.js';

Comment on lines +16 to +27
<<<<<<< HEAD
import { DiscoveredMCPTool, MCP_QUALIFIED_NAME_SEPARATOR } from './mcp-tool.js';
import type { FunctionDeclaration, CallableTool } from '@google/genai';
import { mcpToTool } from '@google/genai';
=======
import { DiscoveredMCPTool } from './mcp-tool.js';
import {
mcpToTool,
type FunctionDeclaration,
type CallableTool,
} from '@google/genai';
>>>>>>> 931e668b4 (refactor(core): standardize MCP tool naming to mcp_ FQN format (#21425))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This file contains unresolved merge conflict markers. The conflicting imports for DiscoveredMCPTool and types from @google/genai must be resolved.

import { DiscoveredMCPTool } from './mcp-tool.js';
import {
  mcpToTool,
  type FunctionDeclaration,
  type CallableTool,
} from '@google/genai';

@gemini-cli gemini-cli bot added the status/need-issue Pull requests that need to have an associated issue. label Mar 6, 2026
@github-actions
Copy link

github-actions bot commented Mar 6, 2026

Size Change: -145 B (0%)

Total Size: 25.9 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 25.4 MB -145 B (0%)
./bundle/node_modules/@google/gemini-cli-devtools/dist/client/main.js 221 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/_client-assets.js 227 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/index.js 11.5 kB 0 B
./bundle/node_modules/@google/gemini-cli-devtools/dist/src/types.js 132 B 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B
./bundle/sandbox-macos-strict-open.sb 4.82 kB 0 B
./bundle/sandbox-macos-strict-proxied.sb 5.02 kB 0 B

compressed-size-action

@abhipatel12 abhipatel12 enabled auto-merge (squash) March 6, 2026 23:15
@abhipatel12 abhipatel12 requested a review from a team as a code owner March 7, 2026 00:15
@abhipatel12 abhipatel12 merged commit a6256cd into release/v0.33.0-preview.4-pr-21425 Mar 7, 2026
25 checks passed
@abhipatel12 abhipatel12 deleted the hotfix/v0.33.0-preview.4/0.33.0-preview.5/preview/cherry-pick-931e668/pr-21425 branch March 7, 2026 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status/need-issue Pull requests that need to have an associated issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants