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

Function normalize_tool_raw

atomic-agent/src/hooks/agy.rs:414–427  ·  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

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

Callers 1

parse_eventMethod · 0.70

Calls 2

getMethod · 0.65
is_emptyMethod · 0.45

Tested by

no test coverage detected