From 61f92562ebcdb8535a04f71bcaaf8959c27dd02a Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Thu, 17 Apr 2025 16:51:21 +0000 Subject: [PATCH] fix: adjust agent output formatting and math server config - Improved output formatting in `test_integration.py` for clarity - Updated `math_server.py` configuration for consistent runtime behavior --- examples/mcp_example/math_server.py | 2 +- examples/mcp_example/test_integration.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/mcp_example/math_server.py b/examples/mcp_example/math_server.py index ca7eaf2e..70221308 100644 --- a/examples/mcp_example/math_server.py +++ b/examples/mcp_example/math_server.py @@ -36,4 +36,4 @@ def calculate_percentage(part: float, whole: float) -> float: if __name__ == "__main__": print("Starting Math Server on port 6274...") - mcp.run(transport="sse", host="0.0.0.0", port=6274) + mcp.run(transport="sse", transport_kwargs={"host": "0.0.0.0", "port": 6274}) diff --git a/examples/mcp_example/test_integration.py b/examples/mcp_example/test_integration.py index eb33d0df..65fbd175 100644 --- a/examples/mcp_example/test_integration.py +++ b/examples/mcp_example/test_integration.py @@ -58,7 +58,11 @@ def main(): if any(op in user_input.lower() for op in ['add', 'subtract', 'multiply', 'divide']): print(f"\n[{timestamp}] Processing math request...") - result = math_agent.run(user_input) + response = math_agent.run(user_input) + if isinstance(response, dict) and 'output' in response: + result = response['output'] + else: + result = response print(f"\n[{timestamp}] Math calculation result: {result}") except KeyboardInterrupt: