Skip to content

Commit ba64960

Browse files
committed
Allow handlesteps to use any tool
1 parent 33e92fd commit ba64960

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

backend/src/run-programmatic-step.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,7 @@ export async function runProgrammaticStep(
296296
state,
297297
autoInsertEndStepParam: true,
298298
excludeToolFromMessageHistory,
299+
fromHandleSteps: true,
299300
})
300301

301302
// TODO: Remove messages from state and always use agentState.messageHistory.

backend/src/tools/tool-executor.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export type ExecuteToolCallParams<T extends string = ToolName> = {
131131
userId: string | undefined
132132
autoInsertEndStepParam?: boolean
133133
excludeToolFromMessageHistory?: boolean
134+
fromHandleSteps?: boolean
134135
} & AgentRuntimeDeps &
135136
AgentRuntimeScopedDeps
136137

@@ -158,6 +159,7 @@ export function executeToolCall<T extends ToolName>(
158159
requestToolCall,
159160
requestMcpToolData,
160161
logger,
162+
fromHandleSteps = false,
161163
} = params
162164
const toolCall: CodebuffToolCall<T> | ToolCallError = parseRawToolCall<T>({
163165
rawToolCall: {
@@ -200,7 +202,10 @@ export function executeToolCall<T extends ToolName>(
200202
toolCalls.push(toolCall)
201203

202204
// Filter out restricted tools in ask mode unless exporting summary
203-
if (!agentTemplate.toolNames.includes(toolCall.toolName)) {
205+
if (
206+
!agentTemplate.toolNames.includes(toolCall.toolName) &&
207+
!fromHandleSteps
208+
) {
204209
const toolResult: ToolResultPart = {
205210
type: 'tool-result',
206211
toolName,
@@ -385,6 +390,7 @@ export async function executeCustomToolCall(
385390
excludeToolFromMessageHistory = false,
386391
requestToolCall,
387392
logger,
393+
fromHandleSteps = false,
388394
} = params
389395
const toolCall: CustomToolCall | ToolCallError = parseRawCustomToolCall({
390396
customToolDefs: await getMCPToolData({
@@ -435,6 +441,7 @@ export async function executeCustomToolCall(
435441
// Filter out restricted tools in ask mode unless exporting summary
436442
if (
437443
!(agentTemplate.toolNames as string[]).includes(toolCall.toolName) &&
444+
!fromHandleSteps &&
438445
!(
439446
toolCall.toolName.includes('/') &&
440447
toolCall.toolName.split('/')[0] in agentTemplate.mcpServers

0 commit comments

Comments
 (0)