Skip to content

Conversation

@hannesrudolph
Copy link
Collaborator

@hannesrudolph hannesrudolph commented Dec 10, 2025

Summary

Add the ability to rename/alias tools for a model using toolAliases configuration in ModelInfo. This allows tools to be presented to the model with alternative names while executing them internally under their original names.

Usage

Add toolAliases to any model's ModelInfo:

"gemini-3-pro-preview": {
  maxTokens: 65_536,
  contextWindow: 1_048_576,
  supportsNativeTools: true,
  toolAliases: ["write_to_file:write_file", "apply_diff:edit_file"],
  // ...
}

Format: "original_tool_name:alias_name"

Changes

  • Added toolAliases?: string[] field to ModelInfo type in packages/types/src/model.ts
  • Added utility functions in src/core/prompts/tools/filter-tools-for-mode.ts:
    • parseToolAliases() - Parses "original:aliasName" format
    • createReverseAliasMap() - Creates reverse lookup map
    • applyToolAliases() - Applies aliases to tools array
  • Updated src/core/task/build-tools.ts to apply aliases during tool building
  • Updated src/core/task/Task.ts to set/clear alias reverse map on NativeToolCallParser
  • Added setToolAliasReverseMap(), clearToolAliasReverseMap(), resolveOriginalToolName(), and resolveToolNames() to NativeToolCallParser
  • Added presentedName?: string to ToolUse interface in src/shared/tools.ts
  • Added comprehensive test suites (36 tests total)

Architecture

  1. Presentation: When building tools for the API, apply_diff becomes edit_file in the tools array sent to the model
  2. Resolution: When the model calls edit_file, NativeToolCallParser.resolveOriginalToolName() resolves it back to apply_diff for internal execution
  3. History: API conversation history uses presentedName so the model sees consistent aliased tool names throughout the conversation

Important

Adds support for model-specific tool aliasing, allowing tools to be presented with alternative names while maintaining original functionality.

  • Behavior:
    • Adds toolAliases to ModelInfo in model.ts for model-specific tool renaming.
    • Updates NativeToolCallParser to handle tool aliasing, including setting and clearing alias maps.
    • Implements alias parsing and application in filter-tools-for-mode.ts.
  • Functions:
    • parseToolAliases(), createReverseAliasMap(), and applyToolAliases() added to filter-tools-for-mode.ts.
    • setToolAliasReverseMap(), clearToolAliasReverseMap(), resolveOriginalToolName(), and resolveToolNames() added to NativeToolCallParser.
  • Tests:
    • Adds tests for tool aliasing in NativeToolCallParser.tool-aliasing.spec.ts and tool-aliasing.spec.ts.
  • Misc:
    • Updates build-tools.ts to integrate tool aliasing into tool building process.
    • Adds presentedName to ToolUse in tools.ts to track aliased names.

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

Add the ability to rename tools for a model using toolAliases config.
Format: toolAliases: ["apply_diff:edit_file", "write_to_file:write_file"]

This allows models to see tools with alternative names while the
internal execution uses the original tool names.
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. Enhancement New feature or request labels Dec 10, 2025
@roomote
Copy link
Contributor

roomote bot commented Dec 10, 2025

Oroocle Clock   Follow along on Roo Cloud

Reviewing your PR now. I'll share feedback in a few minutes!

Previous reviews

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

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Dec 10, 2025
Copy link
Collaborator Author

@hannesrudolph hannesrudolph left a comment

Choose a reason for hiding this comment

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

Review Summary

This PR adds a well-implemented feature allowing tools to be presented to models with alternative names (aliases) while executing internally with their original names. The implementation is solid, well-tested (36 tests passing), type-safe, and follows existing codebase patterns.

✅ Positive Observations

  • Clean Architecture: Clear separation between parsing aliases, applying to API requests, and resolving back during response parsing
  • Comprehensive Tests: Edge cases covered including empty inputs, malformed specs, multiple colons, order independence
  • Good Documentation: JSDoc comments throughout, test files include run commands
  • Type Safety: TypeScript compiles with no errors
  • API History Consistency: presentedName field ensures models see consistent tool names in conversation history

Minor Suggestions (P3)

See inline comments for low-priority enhancement suggestions. These are optional and don't block merge.

Adds console.warn when invalid alias specs are ignored (missing colon,
colon at start/end) to help users troubleshoot misconfigured aliases.
@hannesrudolph
Copy link
Collaborator Author

closed in favour of #9989

@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Dec 10, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants