MCPcopy
hub / github.com/opentrace/opentrace / _write_tool_result

Function _write_tool_result

agent/src/opentrace_agent/benchmarks/agent.py:615–630  ·  view source on GitHub ↗

Write a formatted tool result to the trace output.

(out: Any, content: Any)

Source from the content-addressed store, hash-verified

613
614
615def _write_tool_result(out: Any, content: Any) -> None:
616 """Write a formatted tool result to the trace output."""
617 if isinstance(content, list):
618 parts = []
619 for c in content:
620 if isinstance(c, dict):
621 parts.append(c.get("text", str(c))[:300])
622 else:
623 parts.append(str(c)[:300])
624 content_str = " ".join(parts)
625 else:
626 content_str = str(content)
627 if len(content_str) > 300:
628 content_str = content_str[:297] + "..."
629 out.write(f" {_DIM} → {content_str}{_RESET}\n")
630 out.flush()
631
632
633def _write_tool_call(out: Any, name: str, args: Any, count: int) -> None:

Callers 1

_run_claude_code_tracedFunction · 0.85

Calls 3

writeMethod · 0.80
getMethod · 0.65
flushMethod · 0.65

Tested by

no test coverage detected