fix(mcp): update server and client configurations and agent initialization

pull/819/head
Pavan Kumar 3 months ago committed by ascender1729
parent e34b4462c3
commit 96c266952c

@ -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": "<add|multiply|divide>", "a": <int>, "b": <int>}"""
# 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:")

@ -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)

Loading…
Cancel
Save