feat: add toolAliases support for model-specific tool renaming #9980
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Add the ability to rename/alias tools for a model using
toolAliasesconfiguration in ModelInfo. This allows tools to be presented to the model with alternative names while executing them internally under their original names.Usage
Add
toolAliasesto any model'sModelInfo:Format:
"original_tool_name:alias_name"Changes
toolAliases?: string[]field toModelInfotype inpackages/types/src/model.tssrc/core/prompts/tools/filter-tools-for-mode.ts:parseToolAliases()- Parses "original:aliasName" formatcreateReverseAliasMap()- Creates reverse lookup mapapplyToolAliases()- Applies aliases to tools arraysrc/core/task/build-tools.tsto apply aliases during tool buildingsrc/core/task/Task.tsto set/clear alias reverse map on NativeToolCallParsersetToolAliasReverseMap(),clearToolAliasReverseMap(),resolveOriginalToolName(), andresolveToolNames()toNativeToolCallParserpresentedName?: stringtoToolUseinterface insrc/shared/tools.tsArchitecture
apply_diffbecomesedit_filein the tools array sent to the modeledit_file,NativeToolCallParser.resolveOriginalToolName()resolves it back toapply_difffor internal executionpresentedNameso the model sees consistent aliased tool names throughout the conversationImportant
Adds support for model-specific tool aliasing, allowing tools to be presented with alternative names while maintaining original functionality.
toolAliasestoModelInfoinmodel.tsfor model-specific tool renaming.NativeToolCallParserto handle tool aliasing, including setting and clearing alias maps.filter-tools-for-mode.ts.parseToolAliases(),createReverseAliasMap(), andapplyToolAliases()added tofilter-tools-for-mode.ts.setToolAliasReverseMap(),clearToolAliasReverseMap(),resolveOriginalToolName(), andresolveToolNames()added toNativeToolCallParser.NativeToolCallParser.tool-aliasing.spec.tsandtool-aliasing.spec.ts.build-tools.tsto integrate tool aliasing into tool building process.presentedNametoToolUseintools.tsto track aliased names.This description was created by
for c7881ed. You can customize this summary. It will automatically update as commits are pushed.