MCPcopy Create free account
hub / github.com/CommonstackAI/UncommonRoute / _risk_text

Function _risk_text

uncommon_route/proxy.py:1424–1439  ·  view source on GitHub ↗

Flatten text-bearing content, including Anthropic tool_result blocks.

(value: Any)

Source from the content-addressed store, hash-verified

1422
1423
1424def _risk_text(value: Any) -> str:
1425 """Flatten text-bearing content, including Anthropic tool_result blocks."""
1426 if value is None:
1427 return ""
1428 if isinstance(value, str):
1429 return value
1430 if isinstance(value, list):
1431 parts = [_risk_text(item) for item in value]
1432 return "\n".join(part for part in parts if part)
1433 if isinstance(value, dict):
1434 parts: list[str] = []
1435 for key in ("text", "content", "message", "error", "stderr", "stdout"):
1436 if key in value:
1437 parts.append(_risk_text(value.get(key)))
1438 return "\n".join(part for part in parts if part)
1439 return str(value or "")
1440
1441
1442def _tool_call_command(tool_call: dict[str, Any]) -> str:

Callers 1

Calls 2

appendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected