Skip to content

fix(js/ai): fixed dynamic multipart tools#4787

Merged
pavelgj merged 3 commits intomainfrom
pj/fix-dynamic-multipart-tools
Feb 20, 2026
Merged

fix(js/ai): fixed dynamic multipart tools#4787
pavelgj merged 3 commits intomainfrom
pj/fix-dynamic-multipart-tools

Conversation

@pavelgj
Copy link
Collaborator

@pavelgj pavelgj commented Feb 20, 2026

Checklist (if applicable):

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @pavelgj, 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 handling of dynamic multipart tools within the system. The primary goal is to ensure that these specialized tools are correctly identified and registered, allowing for proper processing during generation requests. The changes involve introducing a new type-checking utility, adjusting the tool registration mechanism, and explicitly categorizing multipart tools as dynamic. This enhancement improves the robustness and clarity of how different tool types are managed.

Highlights

  • New isMultipartTool utility: A new utility function, isMultipartTool, was introduced to correctly identify multipart tools based on their metadata type.
  • Conditional Tool Registration: The tool registration logic in generate.ts was updated to register multipart tools under the tool.v2 action type, while standard tools continue to use tool.
  • Multipart Tools Marked as Dynamic: The multipartTool function now explicitly sets the dynamic metadata property to true, ensuring multipart tools are recognized as dynamic.
  • Comprehensive Testing: New unit tests were added for isMultipartTool, and existing tests for isDynamicTool and generate functionality were updated to include scenarios with dynamic multipart tools.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • js/ai/src/generate.ts
    • Imported isMultipartTool for type checking.
    • Modified tool registration logic to differentiate and register multipart tools under the tool.v2 action type.
  • js/ai/src/tool.ts
    • Added a new export function isMultipartTool to check if an action is a multipart tool.
    • Ensured that tools created with multipartTool are explicitly marked as dynamic in their metadata.
  • js/ai/tests/tool_test.ts
    • Imported isMultipartTool for testing.
    • Added a new test case to isDynamicTool to verify it returns true for dynamic multipart tools.
    • Introduced a new describe block with comprehensive tests for the isMultipartTool function.
  • js/genkit/tests/generate_test.ts
    • Updated imports, replacing dynamicTool with tool.
    • Added a new dynamicMultipartTool to the test suite.
    • Modified the ai.generate call to include the new dynamicMultipartTool.
    • Adjusted assert.deepStrictEqual checks to account for the new multipart tool in the generated request and tool definitions.
Activity
  • The pull request was created by pavelgj.
  • The PR title adheres to conventional commits (fix(js/ai): fixed dynamic multipart tools).
  • The author confirmed that the changes have been manually and unit tested.
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

The pull request correctly addresses the issue where dynamic multipart tools were not being registered properly. By adding dynamic: true to the metadata of multipart tools and updating the registration logic in generate.ts to handle the tool.v2 action type, these tools can now be used dynamically during generation. The addition of the isMultipartTool utility and corresponding tests ensures better maintainability and verification of this feature.

@pavelgj pavelgj marked this pull request as ready for review February 20, 2026 14:48
@pavelgj pavelgj merged commit e05147d into main Feb 20, 2026
6 checks passed
@pavelgj pavelgj deleted the pj/fix-dynamic-multipart-tools branch February 20, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant