diff --git a/examples/mcp_example/mcp_client.py b/examples/mcp_example/mcp_client.py index 1fb3679a..9beef1ed 100644 --- a/examples/mcp_example/mcp_client.py +++ b/examples/mcp_example/mcp_client.py @@ -17,19 +17,22 @@ Remember to use the available MCP tools for calculations rather than doing them def main(): # Configure MCP server connection math_server = MCPServerSseParams( - url="http://0.0.0.0:8000/mcp", + url="http://0.0.0.0:8000", headers={"Content-Type": "application/json"}, timeout=5.0, sse_read_timeout=30.0) + TOOL_CALL_INSTRUCTION = """When you want to use a math tool, reply with a JSON object only: +{"tool_name": "", "a": , "b": }""" + # Initialize math agent math_agent = Agent( agent_name="Math Agent", agent_description="Specialized agent for mathematical computations", - system_prompt=MATH_AGENT_PROMPT, + system_prompt=MATH_AGENT_PROMPT + "\n" + TOOL_CALL_INSTRUCTION, max_loops=1, mcp_servers=[math_server], - streaming_on=True) + streaming_on=False) print("\nMath Agent System Initialized") print("\nAvailable operations:") diff --git a/examples/mcp_example/mock_math_server.py b/examples/mcp_example/mock_math_server.py index 3d54f21e..383a4afc 100644 --- a/examples/mcp_example/mock_math_server.py +++ b/examples/mcp_example/mock_math_server.py @@ -22,4 +22,4 @@ def divide(a: int, b: int) -> float: if __name__ == "__main__": print("Starting Mock Math Server on port 8000...") - mcp.run(transport="sse", port=8000, host="0.0.0.0") + mcp.run(transport="sse", host="0.0.0.0", port=8000)