MCPcopy Index your code
hub / github.com/IBM/AssetOpsBench / _candidate_part

Function _candidate_part

src/agent/opencode_agent/runner.py:252–267  ·  view source on GitHub ↗

Find the message/tool part inside common OpenCode event shapes.

(event: dict[str, Any])

Source from the content-addressed store, hash-verified

250
251
252def _candidate_part(event: dict[str, Any]) -> dict[str, Any] | None:
253 """Find the message/tool part inside common OpenCode event shapes."""
254 for key in ("part", "messagePart"):
255 value = event.get(key)
256 if isinstance(value, dict):
257 return value
258
259 for container_key in ("properties", "data", "payload"):
260 container = event.get(container_key)
261 if not isinstance(container, dict):
262 continue
263 for key in ("part", "messagePart"):
264 value = container.get(key)
265 if isinstance(value, dict):
266 return value
267 return None
268
269
270def _coerce_tool_input(value: Any) -> dict[str, Any]:

Callers 1

Calls 1

getMethod · 0.45

Tested by

no test coverage detected