MCPcopy Index your code
hub / github.com/TanStack/ai / openToolCall

Function openToolCall

packages/ai-codex/src/stream/translate.ts:206–238  ·  view source on GitHub ↗
(item: CodexToolItem)

Source from the content-addressed store, hash-verified

204 }
205
206 function* openToolCall(item: CodexToolItem): Generator<StreamChunk> {
207 if (openedToolItems.has(item.id)) return
208 openedToolItems.add(item.id)
209 const toolCallName = toolNameForItem(item)
210 const input = toolArgsForItem(item)
211 const args = JSON.stringify(input)
212 yield {
213 type: EventType.TOOL_CALL_START,
214 toolCallId: item.id,
215 toolCallName,
216 toolName: toolCallName,
217 model,
218 timestamp: now(),
219 }
220 yield {
221 type: EventType.TOOL_CALL_ARGS,
222 toolCallId: item.id,
223 model,
224 timestamp: now(),
225 delta: args,
226 args,
227 }
228 yield {
229 type: EventType.TOOL_CALL_END,
230 toolCallId: item.id,
231 toolCallName,
232 toolName: toolCallName,
233 model,
234 timestamp: now(),
235 input,
236 }
237 unresolvedToolCalls.add(item.id)
238 }
239
240 function* handleItemCompleted(item: CodexThreadItem): Generator<StreamChunk> {
241 if (item.type === 'agent_message') {

Callers 2

handleItemCompletedFunction · 0.70
translateThreadEventsFunction · 0.70

Calls 4

hasMethod · 0.80
toolNameForItemFunction · 0.70
toolArgsForItemFunction · 0.70
nowFunction · 0.70

Tested by

no test coverage detected