Skip to content

Adding tool combination support#68

Open
aubrypaul wants to merge 2 commits into
mainfrom
tool_combination
Open

Adding tool combination support#68
aubrypaul wants to merge 2 commits into
mainfrom
tool_combination

Conversation

@aubrypaul
Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 24, 2026

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added an option to enable combined tool usage for Chat instances via a chainable configuration method (disabled by default).
  • Bug Fixes

    • Improved browsing/search tool wiring to prevent duplicate tool entries and ensure consistent tool-invocation behavior.

Walkthrough

Adds a tool_combination_enabled flag to Chat with a chainable enableToolCombination(enabled) method; Gemini request payload now includes tool_config.includeServerSideToolInvocations based on the flag and browsing tool wiring was adjusted (removed redundant google_search push).

Changes

Cohort / File(s) Summary
Tool Combination Feature
src/code.gs
Add tool_combination_enabled field and enableToolCombination(enabled) chainable setter. Include tool_config.includeServerSideToolInvocations: tool_combination_enabled in Gemini payload alongside function_calling_config.mode: "AUTO". Adjust browsing tool wiring to remove a redundant tools.push({ google_search: "" }). Removed trailing newline at EOF.

Sequence Diagram(s)

sequenceDiagram
  participant User as User
  participant Chat as Chat (client)
  participant Gemini as Gemini API
  participant Tools as Server-side Tools

  User->>Chat: send message / start chat
  Chat->>Gemini: build request payload
  Note right of Chat: includes function_calling_config.mode = "AUTO"\nand tool_config.includeServerSideToolInvocations = tool_combination_enabled
  Gemini->>Tools: invoke tools if payload requests (google_search, url_context)
  Tools-->>Gemini: tool results
  Gemini-->>Chat: response (may include tool-invocations/results)
  Chat-->>User: final response
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive No pull request description was provided by the author, making it impossible to assess whether it relates to the changeset. Add a description explaining the purpose and impact of tool combination support, including why this feature was added and how it should be used.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Adding tool combination support' directly matches the main change: introducing a new enableToolCombination() method and tool combination configuration.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch tool_combination
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch tool_combination
  • 🛠️ JSDoc Checks: Commit on current branch
  • 🛠️ JSDoc Checks: Create PR

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/code.gs`:
- Around line 306-308: The methods enableToolCombination and enableCompaction
are coercing any truthy value via Boolean(enabled) though their JSDoc promises a
boolean; change them to enforce boolean input by validating typeof enabled ===
"boolean" and either assign enabled directly to the internal flags (e.g.,
tool_combination_enabled, compaction_enabled) or throw a TypeError when a
non-boolean is passed, and return this for chaining; update the implementations
of enableToolCombination and enableCompaction accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: f8e68d44-3de2-4050-a571-ff1aa506e4d1

📥 Commits

Reviewing files that changed from the base of the PR and between e4acb50 and dd38db2.

📒 Files selected for processing (1)
  • src/code.gs
📜 Review details
🔇 Additional comments (3)
src/code.gs (3)

2457-2457: No actionable issue for EOF newline-only change.


57-57: Good default for feature rollout.

tool_combination_enabled = false at Line 57 is a safe default and preserves existing behavior until explicitly enabled.


764-769: I need the review comment text to rewrite. Please provide the original review comment you would like me to verify and rewrite.

Comment thread src/code.gs
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/code.gs`:
- Around line 764-769: The request payload is adding
includeServerSideToolInvocations unconditionally inside the 'tool_config' object
which causes API 400 errors; modify the code that builds the 'tool_config' (the
object containing function_calling_config) so that
includeServerSideToolInvocations is only added when tool_combination_enabled is
true (e.g., construct tool_config, set function_calling_config always, and
conditionally assign includeServerSideToolInvocations = tool_combination_enabled
only when tool_combination_enabled is truthy).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3f74bbec-85f2-4f6a-8716-721a7de34178

📥 Commits

Reviewing files that changed from the base of the PR and between dd38db2 and 988b19e.

📒 Files selected for processing (1)
  • src/code.gs
📜 Review details
🔇 Additional comments (3)
src/code.gs (3)

57-57: Good default for feature flag.

Initializing tool_combination_enabled to false keeps the new behavior opt-in and avoids accidental behavior changes.


306-309: Chainable API addition is consistent.

enableToolCombination(enabled) follows the existing fluent API style and cleanly scopes the flag in Chat.


2457-2457: No concern on EOF newline change.

No functional impact here.

Comment thread src/code.gs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant