MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _render_content

Function _render_content

src/server/mcp_runtime.py:36–51  ·  view source on GitHub ↗

Flatten an MCP result's content blocks to the str ToolResult.output.

(content: Any)

Source from the content-addressed store, hash-verified

34
35
36def _render_content(content: Any) -> str:
37 """Flatten an MCP result's content blocks to the str ToolResult.output."""
38 if isinstance(content, str):
39 return content
40 if not content:
41 return ""
42 parts: list[str] = []
43 for block in content:
44 if isinstance(block, dict):
45 if block.get("type") == "text":
46 parts.append(str(block.get("text", "")))
47 else:
48 parts.append(str(block))
49 else:
50 parts.append(str(block))
51 return "\n".join(parts)
52
53
54class McpRuntime:

Callers 1

_callMethod · 0.85

Calls 3

joinMethod · 0.80
getMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected