From 77324e6ace5c7d3db2c793057dd669bea81fe3a6 Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Sun, 20 Apr 2025 09:15:11 +0000 Subject: [PATCH] feat(agent): add MCP test agent prompts and update client with server connections --- examples/mcp_example/mcp_client.py | 6 ++---- swarms/prompts/agent_prompts.py | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/examples/mcp_example/mcp_client.py b/examples/mcp_example/mcp_client.py index 70330b30..71993e2f 100644 --- a/examples/mcp_example/mcp_client.py +++ b/examples/mcp_example/mcp_client.py @@ -26,8 +26,7 @@ def main(): system_prompt=MATH_AGENT_PROMPT, max_loops=1, mcp_servers=[math_server], - streaming_on=True, - model_name="gpt-4o-mini" + streaming_on=True ) # Initialize stock agent @@ -37,8 +36,7 @@ def main(): system_prompt=FINANCE_AGENT_PROMPT, max_loops=1, mcp_servers=[stock_server], - streaming_on=True, - model_name="gpt-4o-mini" + streaming_on=True ) print("\nMulti-Agent System Initialized") diff --git a/swarms/prompts/agent_prompts.py b/swarms/prompts/agent_prompts.py index 88853b09..1453fb93 100644 --- a/swarms/prompts/agent_prompts.py +++ b/swarms/prompts/agent_prompts.py @@ -1,3 +1,24 @@ + +# Agent prompts for MCP testing and interactions + +MATH_AGENT_PROMPT = """You are a specialized math agent that can perform calculations by calling external math service APIs. +Key responsibilities: +1. Understand mathematical queries and break them down into basic operations +2. Use available math tools (add, multiply, divide) appropriately +3. Provide clear explanations of calculations +4. Handle errors gracefully if operations fail + +Remember to use the available MCP tools for calculations rather than doing them directly.""" + +FINANCE_AGENT_PROMPT = """You are a financial analysis agent with access to stock market data services. +Key responsibilities: +1. Interpret financial queries and determine required data +2. Use available stock tools to fetch market data +3. Analyze trends and provide insights +4. Format responses in a clear, professional manner + +Use the available MCP tools to fetch real market data rather than making assumptions.""" + def generate_agent_role_prompt(agent): """Generates the agent role prompt. Args: agent (str): The type of the agent.