Skip to content

Conversation

@daniel-lxs
Copy link
Member

@daniel-lxs daniel-lxs commented Nov 27, 2025

Summary

This PR adds support for model-specific tool customization by introducing excludedTools and includedTools fields to the ModelInfo schema.

Changes

  • Added excludedTools and includedTools optional fields to ModelInfo schema in packages/types/src/model.ts
  • Implemented applyModelToolCustomization helper function to filter tools based on model configuration
  • Integrated model tool filtering into filterNativeToolsForMode for native protocol support
  • Added comprehensive tests for the new functionality in src/core/prompts/tools/__tests__/filter-tools-for-mode.spec.ts
  • Wired up modelInfo through buildNativeToolsArray and Task.ts

Usage

Providers can now override which native tools are available on a per-model basis via MODEL_DEFAULTS:

const MODEL_DEFAULTS: Record<string, Partial<ModelInfo>> = {
    "model-name": {
        excludedTools: ["search_files", "apply_diff"],  // Remove these tools
        includedTools: ["some_tool"],  // Add these tools (if mode allows)
    },
}

Testing

  • All existing tests pass
  • New tests added for applyModelToolCustomization function covering exclusion, inclusion, and mode-based filtering

This enables better control over tool selection for models with specific needs or limitations.


Important

Add model-specific tool customization via excludedTools and includedTools in ModelInfo, with integration into tool filtering and task setup.

  • ModelInfo Schema:
    • Add excludedTools and includedTools fields to ModelInfo in model.ts.
  • Tool Filtering:
    • Implement applyModelToolCustomization() in filter-tools-for-mode.ts to handle tool inclusion/exclusion based on model settings.
    • Integrate tool customization into filterNativeToolsForMode() in filter-tools-for-mode.ts.
  • Testing:
    • Add tests for applyModelToolCustomization() in filter-tools-for-mode.spec.ts.
    • Test cases cover tool exclusion, inclusion, and mode-based filtering.
  • Task Integration:
    • Pass modelInfo to buildNativeToolsArray() in Task.ts and build-tools.ts.

This description was created by Ellipsis for 43ecbd7. You can customize this summary. It will automatically update as commits are pushed.

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Enhancement New feature or request labels Nov 27, 2025
@roomote
Copy link
Contributor

roomote bot commented Nov 27, 2025

Rooviewer Clock   See task on Roo Cloud

Re-review completed. Latest commit only removed an unused import. The previously identified critical issue remains unresolved.

Issues to resolve:

  • Critical: The excludedTools logic allows models to exclude ALWAYS_AVAILABLE_TOOLS (e.g., ask_followup_question, attempt_completion), which would break core agent functionality. These tools should never be excludable.
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

…ludedTools

- Add excludedTools and includedTools to ModelInfo schema
- Implement applyModelToolCustomization helper to filter tools based on model config
- Integrate model tool filtering into filterNativeToolsForMode for native protocol
- Add comprehensive tests for tool customization functionality
- Wire up modelInfo through buildNativeToolsArray and Task.ts

This allows providers to override which native tools are available on a per-model basis via MODEL_DEFAULTS, enabling better control over tool selection for models with specific needs.
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Nov 27, 2025
@daniel-lxs daniel-lxs force-pushed the feat/model-tool-customization branch from 2349171 to 10cc60b Compare November 27, 2025 00:51
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 27, 2025
- Add customTools array to ToolGroupConfig for defining opt-in only tools
- Update getToolsForMode() to exclude customTools from default tool set
- Modify applyModelToolCustomization() to include customTools only via includedTools
- Add tests for customTools functionality
- Add comprehensive documentation with usage examples

customTools allows defining tools that are NOT available by default,
even when a mode includes their group. These tools are only available
when explicitly included via a model's includedTools configuration.

This enables:
- Gradual rollout of experimental tools
- Model-specific specialized capabilities
- Safe experimentation without affecting default tool sets
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Review] in Roo Code Roadmap Nov 27, 2025
@hannesrudolph hannesrudolph added PR - Needs Review and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Nov 27, 2025
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
@mrubens mrubens merged commit 5a6dd58 into main Nov 27, 2025
10 checks passed
@mrubens mrubens deleted the feat/model-tool-customization branch November 27, 2025 18:45
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Nov 27, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Nov 27, 2025
mini2s added a commit to zgsm-ai/costrict that referenced this pull request Nov 29, 2025
* fix: Filter native tools by mode restrictions (RooCodeInc#9246)

* fix: filter native tools by mode restrictions

Native tools are now filtered based on mode restrictions before being sent to the API, matching the behavior of XML tools. Previously, all native tools were sent to the API regardless of mode, causing the model to attempt using disallowed tools.

Changes:
- Created filterNativeToolsForMode() and filterMcpToolsForMode() utility functions
- Extracted filtering logic from Task.ts into dedicated module
- Applied same filtering approach used for XML tools in system prompt
- Added comprehensive test coverage (10 tests)

Impact:
- Model only sees tools allowed by current mode
- No more failed tool attempts due to mode restrictions
- Consistent behavior between XML and Native protocols
- Better UX with appropriate tool suggestions per mode

* refactor: eliminate repetitive tool checking using group-based approach

- Add getAvailableToolsInGroup() helper to check tools by group instead of individually
- Refactor filterNativeToolsForMode() to reuse getToolsForMode() instead of duplicating logic
- Simplify capabilities.ts by using group-based checks (60% reduction)
- Refactor rules.ts to use group helper (56% reduction)
- Remove debug console.log statements
- Update tests and snapshots

Benefits:
- Eliminates code duplication
- Leverages existing TOOL_GROUPS structure
- More maintainable - new tools in groups work automatically
- All tests passing (26/26)

* fix: add fallback to default mode when mode config not found

Ensures the agent always has functional tools even if:
- A custom mode is deleted while tasks still reference it
- Mode configuration becomes corrupted
- An invalid mode slug is provided

Without this fallback, the agent would have zero tools (not even
ask_followup_question or attempt_completion), completely breaking it.

* Fix broken share button (RooCodeInc#9253)

fix(webview-ui): make Share button popover work by forwarding ref in LucideIconButton

- Convert LucideIconButton to forwardRef so Radix PopoverTrigger(asChild) receives a focusable element
- Enables Share popover and shareCurrentTask flow
- Verified with ShareButton/TaskActions Vitest suites

* Add GPT-5.1 models and clean up reasoning effort logic (RooCodeInc#9252)

* Reasoning effort: capability-driven; add disable/none/minimal; remove GPT-5 minimal special-casing; document UI semantics; remove temporary logs

* Remove Unused supportsReasoningNone

* Roo reasoning: omit field on 'disable'; UI: do not flip enableReasoningEffort when selecting 'disable'

* Update packages/types/src/model.ts

Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>

* Update webview-ui/src/components/settings/SimpleThinkingBudget.tsx

Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>

---------

Co-authored-by: roomote[bot] <219738659+roomote[bot]@users.noreply.github.com>

* fix: make line_ranges optional in read_file tool schema (RooCodeInc#9254)

The OpenAI tool schema required both 'path' and 'line_ranges' in FileEntry,
but the TypeScript type definition marks lineRanges as optional. This caused
the AI to fail when trying to read files without specifying line_ranges.

Changes:
- Updated read_file tool schema to only require 'path' parameter
- line_ranges remains available but optional, matching TypeScript types
- Aligns with implementation which treats lineRanges as optional throughout

Fixes issue where read_file tool kept failing with missing parameters.

* fix: prevent consecutive user messages on streaming retry (RooCodeInc#9249)

* feat(openai): OpenAI Responses: model-driven prompt caching and generic reasoning options refactor (RooCodeInc#9259)

* revert out of scope changes from RooCodeInc#9252 (RooCodeInc#9258)

* Revert "refactor(task): switch to <feedback> wrapper to prevent focus drift after context-management event (condense/truncate)" (RooCodeInc#9261)

* Release v3.32.0 (RooCodeInc#9264)

* Changeset version bump (RooCodeInc#9265)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@use