MCPcopy
hub / github.com/codeaashu/claude-code / yieldMissingToolResultBlocks

Function yieldMissingToolResultBlocks

src/query.ts:123–149  ·  view source on GitHub ↗
(
  assistantMessages: AssistantMessage[],
  errorMessage: string,
)

Source from the content-addressed store, hash-verified

121/* eslint-enable @typescript-eslint/no-require-imports */
122
123function* yieldMissingToolResultBlocks(
124 assistantMessages: AssistantMessage[],
125 errorMessage: string,
126) {
127 for (const assistantMessage of assistantMessages) {
128 // Extract all tool use blocks from this assistant message
129 const toolUseBlocks = assistantMessage.message.content.filter(
130 content => content.type === 'tool_use',
131 ) as ToolUseBlock[]
132
133 // Emit an interruption message for each tool use
134 for (const toolUse of toolUseBlocks) {
135 yield createUserMessage({
136 content: [
137 {
138 type: 'tool_result',
139 content: errorMessage,
140 is_error: true,
141 tool_use_id: toolUse.id,
142 },
143 ],
144 toolUseResult: errorMessage,
145 sourceToolAssistantUUID: assistantMessage.uuid,
146 })
147 }
148 }
149}
150
151/**
152 * The rules of thinking are lengthy and fortuitous. They require plenty of thinking

Callers 1

queryLoopFunction · 0.85

Calls 1

createUserMessageFunction · 0.85

Tested by

no test coverage detected