From b9ddc149419b8fd0736624e673fa7fbdc89f881c Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Thu, 17 Apr 2025 18:19:23 +0000 Subject: [PATCH] feat: enhance agent responses to describe supported capabilities - Updated `mock_multi_agent.py` to provide meaningful responses to capability-related queries - Ensured agents clearly state what operations they can perform (e.g., add, multiply, divide) --- examples/mcp_example/mock_multi_agent.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/examples/mcp_example/mock_multi_agent.py b/examples/mcp_example/mock_multi_agent.py index bc8fb679..7c3fac22 100644 --- a/examples/mcp_example/mock_multi_agent.py +++ b/examples/mcp_example/mock_multi_agent.py @@ -25,6 +25,21 @@ class MathAgent: async def process(self, task: str): try: + # Check if asking about capabilities + if any(word in task.lower() for word in ['what', 'how', 'can', 'capabilities', 'help']): + if self.agent.agent_name == "Calculator": + return { + "agent": self.agent.agent_name, + "task": task, + "response": "I can perform basic mathematical operations: addition (use '+' or 'plus'), multiplication (use '*' or 'times'), and division (use '/' or 'divide by'). For example: '5 plus 3' or '10 divide by 2'" + } + else: # StockAnalyst + return { + "agent": self.agent.agent_name, + "task": task, + "response": "I can analyze stock data using moving averages and calculate percentage changes. For example: 'calculate moving average of [10,20,30,40,50] over 3 periods'" + } + # Check if input is math-related math_keywords = ['add', 'plus', '+', 'multiply', 'times', '*', 'x', 'divide', '/', 'by'] if not any(keyword in task.lower() for keyword in math_keywords):