Skip to content

Commit d859b3c

Browse files
committed
Thread includeToolCall through properly from sdk
1 parent 4ca5d5b commit d859b3c

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

cli/src/components/message-block.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,7 @@ export const MessageBlock = ({
130130
if (toolBlock.toolName === 'end_turn') {
131131
return null
132132
}
133-
if (
134-
'includeToolCall' in toolBlock.input &&
135-
toolBlock.input.includeToolCall === false
136-
) {
133+
if ('includeToolCall' in toolBlock && toolBlock.includeToolCall === false) {
137134
return null
138135
}
139136

cli/src/hooks/use-send-message.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ export const useSendMessage = ({
10561056
}
10571057

10581058
if (event.type === 'tool_call' && event.toolCallId) {
1059-
const { toolCallId, toolName, input, agentId } = event
1059+
const { toolCallId, toolName, input, agentId, includeToolCall } = event
10601060

10611061
if (toolName === 'spawn_agents' && input?.agents) {
10621062
const agents = Array.isArray(input.agents) ? input.agents : []
@@ -1136,6 +1136,7 @@ export const useSendMessage = ({
11361136
toolName,
11371137
input,
11381138
agentId,
1139+
...(includeToolCall !== undefined && { includeToolCall }),
11391140
}
11401141

11411142
return {
@@ -1165,6 +1166,7 @@ export const useSendMessage = ({
11651166
toolName,
11661167
input,
11671168
agentId,
1169+
...(includeToolCall !== undefined && { includeToolCall }),
11681170
}
11691171

11701172
return {

cli/src/types/chat.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export type ContentBlock =
2828
output?: string
2929
outputRaw?: unknown
3030
agentId?: string
31+
includeToolCall?: boolean
3132
}
3233
| {
3334
type: 'agent'

common/src/types/print-mode.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export const printModeToolCallSchema = z.object({
3131
input: z.record(z.string(), z.any()),
3232
agentId: z.string().optional(),
3333
parentAgentId: z.string().optional(),
34+
includeToolCall: z.boolean().optional(),
3435
})
3536
export type PrintModeToolCall = z.infer<typeof printModeToolCallSchema>
3637

packages/agent-runtime/src/tools/tool-executor.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ export function executeToolCall<T extends ToolName>(
205205
input: toolCall.input,
206206
// Only include agentId for subagents (agents with a parent)
207207
...(state.agentState?.parentId && { agentId: state.agentState.agentId }),
208+
// Include includeToolCall flag if explicitly set to false
209+
...(excludeToolFromMessageHistory && { includeToolCall: false }),
208210
})
209211

210212
toolCalls.push(toolCall)
@@ -442,6 +444,8 @@ export async function executeCustomToolCall(
442444
input: toolCall.input,
443445
// Only include agentId for subagents (agents with a parent)
444446
...(state.agentState?.parentId && { agentId: state.agentState.agentId }),
447+
// Include includeToolCall flag if explicitly set to false
448+
...(excludeToolFromMessageHistory && { includeToolCall: false }),
445449
})
446450

447451
toolCalls.push(toolCall)

0 commit comments

Comments
 (0)