(statusCode int, errorText string)
| 1260 | case "tool_result": |
| 1261 | result.ToolResults = append(result.ToolResults, map[string]any{ |
| 1262 | "tool_use_id": getString(block, "tool_use_id"), |
| 1263 | "content": extractToolResultText(block), |
| 1264 | "is_error": getBool(block, "is_error"), |
| 1265 | }) |
| 1266 | } |
| 1267 | } |
| 1268 | |
| 1269 | return result |
| 1270 | } |
| 1271 | |
| 1272 | type consumeResult struct { |
| 1273 | ToolMessages []map[string]any |
| 1274 | TrailingText string |
| 1275 | MatchedIDs map[string]struct{} |
| 1276 | } |
| 1277 | |
| 1278 | func consumeToolResultCarrier(message map[string]any, expectedIDs map[string]struct{}) (*consumeResult, bool) { |
| 1279 | if getString(message, "role") != "user" { |
| 1280 | return nil, false |
| 1281 | } |
| 1282 | |
| 1283 | content, ok := normalizeContentBlocks(message["content"]) |
| 1284 | if !ok { |
| 1285 | return nil, false |
no outgoing calls
no test coverage detected