1818"""
1919
2020import logging
21+ import uuid
2122
2223from ..analytics .agent import create_analytics_agent
2324
@@ -128,15 +129,15 @@ def wrapper(config=None, session=None, model_id=None, **kwargs):
128129 test_strands_agent , test_mcp_client = test_result
129130
130131 # Extract available tools for dynamic description
131- dynamic_description = f"Agent { i } which connects to external MCP servers to provide additional tools and capabilities "
132+ tools_description = " "
132133 if (
133134 hasattr (test_strands_agent , "tool_names" )
134135 and test_strands_agent .tool_names
135136 ):
136137 tool_names = list (test_strands_agent .tool_names )
137138 if tool_names :
138139 tools_list = ", " .join (tool_names )
139- dynamic_description = f"Agent { i } with access to external MCP tools : { tools_list } . Use this agent to access external capabilities and services ."
140+ tools_description = f" The tools available are : { tools_list } ."
140141
141142 # Clean up the test MCP client
142143 if test_mcp_client :
@@ -148,21 +149,39 @@ def wrapper(config=None, session=None, model_id=None, **kwargs):
148149
149150 except Exception as e :
150151 logger .warning (f"Could not discover MCP tools for agent { i } : { e } " )
151- dynamic_description = f"Agent { i } which connects to external MCP servers to provide additional tools and capabilities"
152+ tools_description = ""
153+
154+ # Determine agent name and ID
155+ if "agent_name" in mcp_config and mcp_config ["agent_name" ]:
156+ agent_name = mcp_config ["agent_name" ]
157+ # Create ID from name with UUID for uniqueness
158+ name_no_spaces = agent_name .replace (" " , "_" ).lower ()
159+ agent_id = f"{ name_no_spaces } _{ str (uuid .uuid4 ())[:8 ]} "
160+ else :
161+ agent_name = f"External MCP Agent { i } "
162+ agent_id = f"external-mcp-agent-{ i } "
163+
164+ # Determine agent description
165+ if "agent_description" in mcp_config and mcp_config ["agent_description" ]:
166+ agent_description = mcp_config ["agent_description" ] + tools_description
167+ else :
168+ agent_description = f"Agent which connects to external MCP servers to provide additional tools and capabilities.{ tools_description } "
152169
153170 # Register the agent
154171 agent_factory .register_agent (
155- agent_id = f"external-mcp-agent- { i } " ,
156- agent_name = f"External MCP Agent { i } " ,
157- agent_description = dynamic_description ,
172+ agent_id = agent_id ,
173+ agent_name = agent_name ,
174+ agent_description = agent_description ,
158175 creator_func = create_mcp_agent_wrapper (),
159176 sample_queries = [
160177 "What tools are available from the external MCP server?" ,
161178 "Help me use the external tools to solve my problem" ,
162179 "Show me what capabilities the MCP server provides" ,
163180 ],
164181 )
165- logger .info (f"External MCP Agent { i } registered successfully" )
182+ logger .info (
183+ f"External MCP Agent '{ agent_name } ' registered successfully with ID '{ agent_id } '"
184+ )
166185
167186except Exception as e :
168187 logger .warning (
0 commit comments