MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / handleRegularToolCall

Function handleRegularToolCall

cli/src/utils/sdk-event-handlers.ts:303–329  ·  view source on GitHub ↗
(
  state: EventHandlerState,
  event: PrintModeToolCall,
)

Source from the content-addressed store, hash-verified

301}
302
303const handleRegularToolCall = (
304 state: EventHandlerState,
305 event: PrintModeToolCall,
306) => {
307 const newToolBlock: ToolContentBlock = {
308 type: 'tool',
309 toolCallId: event.toolCallId,
310 toolName: event.toolName as ToolName,
311 input: event.input,
312 agentId: event.agentId,
313 ...(event.includeToolCall !== undefined && {
314 includeToolCall: event.includeToolCall,
315 }),
316 }
317
318 if (event.parentAgentId && event.agentId) {
319 state.message.updater.updateAiMessageBlocks((blocks) =>
320 appendToolToAgentBlock(blocks, event.agentId as string, newToolBlock),
321 )
322 return
323 }
324
325 state.message.updater.updateAiMessageBlocks((blocks) => [
326 ...blocks,
327 newToolBlock,
328 ])
329}
330
331const handleToolCall = (state: EventHandlerState, event: PrintModeToolCall) => {
332 // Close any open native reasoning blocks when a tool call happens

Callers 1

handleToolCallFunction · 0.85

Calls 1

appendToolToAgentBlockFunction · 0.90

Tested by

no test coverage detected