MCPcopy
hub / github.com/zai-org/GLM-4 / tool_call

Function tool_call

demo/composite_demo/src/tools/python.py:193–201  ·  view source on GitHub ↗
(code: str, session_id: str)

Source from the content-addressed store, hash-verified

191
192
193def tool_call(code: str, session_id: str) -> list[ToolObservation]:
194 kernel = get_kernel()
195 res_type, res = execute(code, kernel)
196
197 # Convert base64 to data uri
198 text = "[Image]" if res_type == "image" else res
199 image = f"data:image/png;base64,{res}" if res_type == "image" else None
200
201 return [ToolObservation(res_type, text, image)]

Callers

nothing calls this directly

Calls 3

get_kernelFunction · 0.85
executeFunction · 0.85
ToolObservationClass · 0.70

Tested by

no test coverage detected