INNER CODE UNIT · Python
_summarize_result
VersusControl/devops-ai-guidelines · 03-ai-agent-for-devops/code/10/app.py:87
def _summarize_result(tool_name: str, result: str) -> str:
"""One-line preview of a tool result for the progress panel."""
r = str(result)
if tool_name == "list_log_files":
count = r.count(".log")
return f"found {count} log file{'s' if count != 1 else ''}"
if tool_name == "read_log_file":
return "file read"
if tool_name == "search_logs":
first_line = r.split("\n")[0]
return first_line.lower() if "Found" in first_line else "search complete"
if tool_name == "send_slack_notification":
return "notification sent"
if tool_name in ("reboot_rds_instance", "restart_kubernetes_pod"):
return "initiated"
return r[:80]