MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / normalize_tool_raw

Function normalize_tool_raw

atomic-agent/src/hooks/agy.rs:417–430  ·  view source on GitHub ↗

Map Antigravity's `error` field onto the `status` field the provenance accumulator reads for tool calls.

(mut raw: Value)

Source from the content-addressed store, hash-verified

415/// Map Antigravity's `error` field onto the `status` field the provenance
416/// accumulator reads for tool calls.
417fn normalize_tool_raw(mut raw: Value) -> Value {
418 let has_error = raw
419 .get("error")
420 .and_then(Value::as_str)
421 .is_some_and(|e| !e.is_empty());
422
423 if let Some(obj) = raw.as_object_mut() {
424 obj.entry("status".to_string()).or_insert_with(|| {
425 Value::String(if has_error { "error" } else { "completed" }.to_string())
426 });
427 }
428
429 raw
430}
431
432#[cfg(test)]
433mod tests {

Callers 1

parse_eventMethod · 0.70

Calls 2

getMethod · 0.65
is_emptyMethod · 0.45

Tested by

no test coverage detected