fix: handle empty output case in PythonTool execution

This commit is contained in:
Soulter
2026-01-15 00:48:50 +08:00
parent c52ab1346b
commit 937f0b7f32

View File

@@ -62,6 +62,11 @@ class PythonTool(FunctionTool):
if text:
resp.content.append(mcp.types.TextContent(type="text", text=text))
if not resp.content:
resp.content.append(
mcp.types.TextContent(type="text", text="No output.")
)
return resp
except Exception as e: