Skip to content

feat: enhance listing of third-party tools - #7

Merged
aeroxy merged 3 commits into
mainfrom
dev
Jun 5, 2026
Merged

feat: enhance listing of third-party tools#7
aeroxy merged 3 commits into
mainfrom
dev

Conversation

@aeroxy

@aeroxy aeroxy commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Bug Fixes & Improvements
    • Improved third‑party tool discovery to normalize different group formats and display grouped results with names and descriptions.
    • Added a clear “no tools found” message when no tools are available.
    • Enhanced in‑page tool execution to first use the primary executor, then fall back to searching available tool listings and invoking matched tools.
    • Returns explicit error when a requested tool cannot be found.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9d598ecd-86a2-4434-8f2e-305140d73e08

📥 Commits

Reviewing files that changed from the base of the PR and between 2a6ea2d and c314b42.

📒 Files selected for processing (1)
  • src/commands/third_party.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/commands/third_party.rs

📝 Walkthrough

Walkthrough

The PR normalizes third-party tool discovery into a { groups: [...] } payload and updates Rust rendering to iterate groups. Execution now checks dtmcp presence, prefers dtmcp.executeTool, and falls back to finding and calling a tool's execute method; explicit error is returned when a tool isn't found.

Changes

Third-party tool integration with grouping and fallback execution

Layer / File(s) Summary
List tools with grouping support
src/commands/third_party.rs
Page JS returns a normalized { groups: [...] } structure (handles dtmcp.toolGroups and dtmcp.toolGroup). Rust parses groups, sums tool counts, returns "no tools found" when empty, and formats output with group headers and indented tool listings.
Execute tool with fallback path
src/commands/third_party.rs
Page JS verifies dtmcp exists, uses dtmcp.executeTool when available, otherwise searches dtmcp.toolGroups/dtmcp.toolGroup for a matching tool and calls tool.execute(params). Returns an explicit "Tool ... not found" error when missing.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰
I hopped through grouped tools, neat and bright,
Found names and descriptions all lined up right,
When execute paths split and the main door closed,
I sniffed the groups until the right one posed,
Then called "execute" and danced in the moonlight.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: enhance listing of third-party tools' directly aligns with the main changes: improved JavaScript evaluation for normalizing tool groups and updated server-side parsing for listing third-party tools.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 updates the third-party tool integration in src/commands/third_party.rs to support multiple tool groups (toolGroups) alongside the existing single toolGroup structure. It modifies the injected JavaScript in both list_3p_tools and execute_3p_tool to handle nested tool structures, and updates the Rust formatting logic to group the output by tool group. The review feedback highlights several opportunities to prevent runtime TypeErrors in the injected JavaScript by explicitly checking if properties are arrays using Array.isArray before mapping or finding elements. Additionally, it suggests avoiding printing the "Available tools:" header when a tool group is empty.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/commands/third_party.rs
Comment thread src/commands/third_party.rs
Comment thread src/commands/third_party.rs
Comment thread src/commands/third_party.rs

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
src/commands/third_party.rs (1)

83-90: 💤 Low value

Minor: "Available tools:" header printed for groups with no tools.

If a group exists but has an empty tools array, the output will show "Available tools:" followed by nothing. This could happen if groups contains groups with zero tools while the total across all groups is > 0. Consider guarding the header:

             if let Some(tools) = group["tools"].as_array() {
-                output.push_str("Available tools:\n");
-                for tool in tools {
-                    let tname = tool["name"].as_str().unwrap_or("unknown");
-                    let tdesc = tool["description"].as_str().unwrap_or("");
-                    output.push_str(&format!("  - {}: {}\n", tname, tdesc));
+                if !tools.is_empty() {
+                    output.push_str("Available tools:\n");
+                    for tool in tools {
+                        let tname = tool["name"].as_str().unwrap_or("unknown");
+                        let tdesc = tool["description"].as_str().unwrap_or("");
+                        output.push_str(&format!("  - {}: {}\n", tname, tdesc));
+                    }
                 }
             }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/commands/third_party.rs` around lines 83 - 90, The header "Available
tools:" is printed even when a group's "tools" array is empty; modify the
conditional around group["tools"] so you only push the header when the array is
present and non-empty (e.g., check tools.is_empty() before calling
output.push_str("Available tools:\n")). Update the block referencing
group["tools"], the loop over tools, and the header emission so the header is
skipped for empty arrays while keeping the existing logic that extracts tname
and tdesc.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/commands/third_party.rs`:
- Around line 83-90: The header "Available tools:" is printed even when a
group's "tools" array is empty; modify the conditional around group["tools"] so
you only push the header when the array is present and non-empty (e.g., check
tools.is_empty() before calling output.push_str("Available tools:\n")). Update
the block referencing group["tools"], the loop over tools, and the header
emission so the header is skipped for empty arrays while keeping the existing
logic that extracts tname and tdesc.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 60b08d68-764e-4977-b128-7fb918d33142

📥 Commits

Reviewing files that changed from the base of the PR and between fce2afc and d66d516.

📒 Files selected for processing (1)
  • src/commands/third_party.rs

@aeroxy

aeroxy commented Jun 5, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 updates the third-party tool integration to support multiple tool groups (dtmcp.toolGroups) alongside the existing single dtmcp.toolGroup configuration. The Rust code has been updated to parse and format multiple groups, and the injected JavaScript expressions now support querying and executing tools across these groups. The review feedback suggests making the injected JavaScript more robust by adding defensive checks against null, undefined, or non-array values in toolGroups and tools, and improving the CLI output formatting by removing a trailing newline.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/commands/third_party.rs
Comment thread src/commands/third_party.rs Outdated
Comment thread src/commands/third_party.rs
@aeroxy

aeroxy commented Jun 5, 2026

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 updates the third-party tool integration in src/commands/third_party.rs to support multiple tool groups (toolGroups) alongside the existing single toolGroup fallback. It refactors the listing output to group tools by their respective tool groups and updates the execution logic to search through all available tool groups if a global execution function is not present. The review feedback suggests adding defensive checks in the injected JavaScript code to handle potential null or undefined values within the tool groups and tools arrays, ensuring robustness against arbitrary web page environments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread src/commands/third_party.rs
Comment thread src/commands/third_party.rs
@aeroxy
aeroxy merged commit 18dad4f into main Jun 5, 2026
1 check passed
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