MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / extractToolResultText

Function extractToolResultText

api/client.go:1227–1260  ·  view source on GitHub ↗
(block map[string]any)

Source from the content-addressed store, hash-verified

1225 if !ok {
1226 return nil, false
1227 }
1228 normalized = append(normalized, block)
1229 }
1230 return normalized, true
1231 default:
1232 return nil, false
1233 }
1234}
1235
1236func splitAnthropicBlocks(content []map[string]any) splitBlocksResult {
1237 result := splitBlocksResult{
1238 TextParts: []string{},
1239 ToolCalls: []map[string]any{},
1240 ToolResults: []map[string]any{},
1241 }
1242
1243 for _, block := range content {
1244 switch getString(block, "type") {
1245 case "text":
1246 result.TextParts = append(result.TextParts, getString(block, "text"))
1247
1248 case "tool_use":
1249 arguments := pythonJSONDumps(block["input"])
1250
1251 result.ToolCalls = append(result.ToolCalls, map[string]any{
1252 "id": getString(block, "id"),
1253 "type": "function",
1254 "function": map[string]any{
1255 "name": getString(block, "name"),
1256 "arguments": arguments,
1257 },
1258 })
1259
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),

Callers 2

splitAnthropicBlocksFunction · 0.85
consumeToolResultCarrierFunction · 0.85

Calls 1

getStringFunction · 0.85

Tested by

no test coverage detected