@@ -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