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

Function summarize_verification

atomic-agent/src/provenance/classify.rs:552–589  ·  view source on GitHub ↗
(
    tool_input: Option<&serde_json::Value>,
    tool_output: Option<&str>,
)

Source from the content-addressed store, hash-verified

550}
551
552fn summarize_verification(
553 tool_input: Option<&serde_json::Value>,
554 tool_output: Option<&str>,
555) -> String {
556 let cmd = extract_command(tool_input);
557 let cmd = cmd.trim();
558
559 let passed = tool_output.and_then(|o| {
560 let lower = o.to_lowercase();
561 // Heuristic: look for common pass/fail signals.
562 // Order matters: "0 failed" is a PASS signal, so check it before
563 // the generic "fail" pattern.
564 if lower.contains("0 failed")
565 || lower.contains("test result: ok")
566 || lower.contains("tests passed")
567 {
568 Some(true)
569 } else if lower.contains("fail") || lower.contains("failed") || lower.contains("error") {
570 Some(false)
571 } else if lower.contains("pass") || lower.contains("ok") || lower.contains("success") {
572 Some(true)
573 } else {
574 None
575 }
576 });
577
578 let result_suffix = match passed {
579 Some(true) => " (passed)",
580 Some(false) => " (failed)",
581 None => "",
582 };
583
584 if cmd.is_empty() {
585 format!("Run verification{}", result_suffix)
586 } else {
587 format!("{}{}", truncate_for_summary(cmd, 300), result_suffix)
588 }
589}
590
591fn summarize_execution(tool_name: &str, tool_input: Option<&serde_json::Value>) -> String {
592 // For shell commands, show the command

Callers 1

summarize_tool_callFunction · 0.85

Calls 3

extract_commandFunction · 0.70
containsMethod · 0.45
is_emptyMethod · 0.45

Tested by

no test coverage detected