feat: add native tool call setting with feature flag support (#7193)

* feat: add native tool call setting with feature flag support

Add a new native tool call setting that allows users to enable/disable native tool calling functionality. The setting is controlled by both a user preference and a feature flag, providing flexibility for gradual rollout. Changes include:
- Added native_tool_call_enabled field to UpdateSettingsRequest proto
- Implemented state management for the setting in controller and storage
- Added UI toggle in feature settings section
- Updated task execution logic to check both user setting and feature flag
- Extended extension state interface to include the new setting

* Add changeset
This commit is contained in:
Bee authored and GitHub committed 2025-10-30 17:47:35 -07:00
1 parent 8eeeabb966
commit ff20c4addc
10 files changed
+47 -3

No files matched your search

+5
View File
@@ -0,0 +1,5 @@
---
"claude-dev": patch
---
Add native tool calling support with configurable setting.
+1
View File
@@ -350,6 +350,7 @@ message UpdateSettingsRequest {
optional bool subagents_enabled = 29;
optional int32 subagent_terminal_output_line_limit = 30;
optional string cline_env = 31;
optional bool native_tool_call_enabled = 32;
}
message UpdateTerminalConnectionTimeoutRequest {
+4
View File
@@ -915,6 +915,10 @@ export class Controller {
remoteConfigSettings: this.stateManager.getRemoteConfigSettings(),
lastDismissedCliBannerVersion,
subagentsEnabled,
nativeToolCallSetting: {
user: this.stateManager.getGlobalStateKey("nativeToolCallEnabled"),
featureFlag: featureFlagsService.getNativeToolCallEnabled(),
},
}
}
@@ -349,6 +349,10 @@ export async function updateSettings(controller: Controller, request: UpdateSett
controller.stateManager.setGlobalState("subagentsEnabled", !!request.subagentsEnabled)
}
if (request.nativeToolCallEnabled !== undefined) {
controller.stateManager.setGlobalState("nativeToolCallEnabled", !!request.nativeToolCallEnabled)
}
// Post updated state to webview
await controller.postStateToWebview()
+3
View File
@@ -468,6 +468,8 @@ export async function readGlobalStateFromDisk(context: ExtensionContext): Promis
*/
const primaryRootIndex = context.globalState.get<GlobalStateAndSettings["primaryRootIndex"]>("primaryRootIndex")
const multiRootEnabled = context.globalState.get<GlobalStateAndSettings["multiRootEnabled"]>("multiRootEnabled")
const nativeToolCallEnabled =
context.globalState.get<GlobalStateAndSettings["nativeToolCallEnabled"]>("nativeToolCallEnabled")
return {
// api configuration fields
@@ -623,6 +625,7 @@ export async function readGlobalStateFromDisk(context: ExtensionContext): Promis
lastDismissedInfoBannerVersion: lastDismissedInfoBannerVersion ?? 0,
lastDismissedModelBannerVersion: lastDismissedModelBannerVersion ?? 0,
lastDismissedCliBannerVersion: lastDismissedCliBannerVersion ?? 0,
nativeToolCallEnabled: nativeToolCallEnabled ?? false,
// Multi-root workspace support
workspaceRoots,
primaryRootIndex: primaryRootIndex ?? 0,
+2 -1
View File
@@ -1835,7 +1835,8 @@ export class Task {
workspaceRoots,
isSubagentsEnabledAndCliInstalled,
isCliSubagent,
enableNativeToolCalls: featureFlagsService.getNativeToolCallEnabled(),
enableNativeToolCalls:
featureFlagsService.getNativeToolCallEnabled() && this.stateManager.getGlobalStateKey("nativeToolCallEnabled"),
}
const { systemPrompt, tools } = await getSystemPrompt(promptContext)
+1
View File
@@ -97,6 +97,7 @@ export interface ExtensionState {
hooksEnabled?: ClineFeatureSetting
remoteConfigSettings?: Partial<GlobalStateAndSettings>
subagentsEnabled?: boolean
nativeToolCallSetting?: ClineFeatureSetting
}
export interface ClineMessage {
+1
View File
@@ -43,6 +43,7 @@ export interface GlobalState {
lastDismissedInfoBannerVersion: number
lastDismissedModelBannerVersion: number
lastDismissedCliBannerVersion: number
nativeToolCallEnabled: boolean
}
export interface Settings {
@@ -33,6 +33,7 @@ const FeatureSettingsSection = ({ renderSectionHeader }: FeatureSettingsSectionP
hooksEnabled,
remoteConfigSettings,
subagentsEnabled,
nativeToolCallSetting,
} = useExtensionState()
const [isClineCliInstalled, setIsClineCliInstalled] = useState(false)
@@ -366,7 +367,9 @@ const FeatureSettingsSection = ({ renderSectionHeader }: FeatureSettingsSectionP
Enable Multi-Root Workspace
</VSCodeCheckbox>
<p className="text-xs">
<span className="text-(--vscode-errorForeground)">Experimental: </span>{" "}
<span className="text-xs bg-button-background/80 text-button-foreground px-2 py-1 rounded-lg mr-1">
Experimental
</span>
<span className="text-description">Allows cline to work across multiple workspaces.</span>
</p>
</div>
@@ -382,13 +385,33 @@ const FeatureSettingsSection = ({ renderSectionHeader }: FeatureSettingsSectionP
Enable Hooks
</VSCodeCheckbox>
<p className="text-xs">
<span className="text-(--vscode-errorForeground)">Experimental: </span>{" "}
<span className="text-xs bg-button-background/80 text-button-foreground px-2 py-1 rounded-lg mr-1">
Experimental
</span>
<span className="text-description">
Allows execution of hooks from .clinerules/hooks/ directory.
</span>
</p>
</div>
)}
{nativeToolCallSetting?.featureFlag && (
<div className="mt-2.5">
<VSCodeCheckbox
checked={nativeToolCallSetting?.user}
onChange={(e) => {
const enabled = (e?.target as HTMLInputElement).checked
updateSetting("nativeToolCallEnabled", enabled)
}}>
Enable Native Tool Call
</VSCodeCheckbox>
<p className="text-xs">
<span className="text-xs bg-button-background/80 text-button-foreground px-2 py-1 rounded-lg mr-1">
Experimental
</span>
<span className="text-description">Allows Cline to call tools through the native API.</span>
</p>
</div>
)}
<div style={{ marginTop: 10 }}>
<Tooltip>
<TooltipTrigger asChild>
@@ -232,6 +232,7 @@ export const ExtensionStateContextProvider: React.FC<{
isMultiRootWorkspace: false,
multiRootSetting: { user: false, featureFlag: false },
hooksEnabled: { user: false, featureFlag: false },
nativeToolCallSetting: { user: false, featureFlag: false },
})
const [expandTaskHeader, setExpandTaskHeader] = useState(true)
const [didHydrateState, setDidHydrateState] = useState(false)