Skip to content

Commit f12a244

Browse files
ruff format
1 parent cb94bc3 commit f12a244

File tree

4 files changed

+18
-16
lines changed

4 files changed

+18
-16
lines changed

libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@
2121

2222
__all__ = [
2323
"McpToolRegistrationService",
24-
]
24+
]

libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/services/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414

1515
__all__ = [
1616
"McpToolRegistrationService",
17-
]
17+
]

libraries/microsoft-agents-a365-tooling-extensions-agentframework/microsoft_agents_a365/tooling/extensions/agentframework/services/mcp_tool_registration_service.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class McpToolRegistrationService:
3434
Provides MCP tool registration services for Agent Framework agents.
3535
3636
This service handles registration and management of MCP (Model Context Protocol)
37-
tool servers with Agent Framework agents. It provides seamless integration
37+
tool servers with Agent Framework agents. It provides seamless integration
3838
between MCP servers and Microsoft Agent Framework.
3939
4040
Features:
@@ -89,7 +89,7 @@ async def add_tool_servers_to_agent(
8989
) -> "ChatAgent":
9090
"""
9191
Add new MCP servers to the agent by creating a new ChatAgent instance.
92-
92+
9393
Note: Due to Agent Framework design, MCP tools must be set during
9494
ChatAgent creation. If new tools are found, this method creates a new ChatAgent
9595
instance with all tools (existing + new) properly initialized.
@@ -118,22 +118,22 @@ async def add_tool_servers_to_agent(
118118
try:
119119
# Step 2: Now update agent by adding MCP tools
120120
updated_tools = []
121-
121+
122122
# Keep any existing tools that were passed in
123123
updated_tools.extend(initial_tools)
124124

125125
# Get MCP tool server configurations
126126
servers = await self._mcp_server_configuration_service.list_tool_servers(
127127
agent_user_id, environment_id, auth_token
128128
)
129-
129+
130130
# Retrieve MCP tools from all configured servers
131131
for server in servers:
132132
try:
133133
mcp_tools = await self._get_tools(server, environment_id, auth_token)
134134
# Add the MCP tools
135135
updated_tools.extend(mcp_tools)
136-
136+
137137
self._logger.info(
138138
f"Successfully loaded {len(mcp_tools)} tools from MCP server '{server.mcp_server_name}'"
139139
)
@@ -148,14 +148,12 @@ async def add_tool_servers_to_agent(
148148

149149
# Create ChatAgent with updated tools (since ChatAgent is immutable)
150150
agent_with_tools = ChatAgent(
151-
chat_client=chat_client,
152-
instructions=agent_instructions,
153-
tools=updated_tools
151+
chat_client=chat_client, instructions=agent_instructions, tools=updated_tools
154152
)
155153

156154
# Return the enhanced agent
157155
return agent_with_tools
158-
156+
159157
except Exception as ex:
160158
self._logger.error(
161159
f"Failed to add MCP tool servers for agent {agent_user_id} in environment {environment_id}: {ex}"
@@ -202,10 +200,14 @@ async def _get_tools(
202200

203201
# Get tools from the MCP plugin
204202
tools = await plugin.get_tools()
205-
206-
self._logger.info(f"Retrieved {len(tools)} tools from MCP server {server.mcp_server_name}")
203+
204+
self._logger.info(
205+
f"Retrieved {len(tools)} tools from MCP server {server.mcp_server_name}"
206+
)
207207
return tools
208208

209209
except Exception as ex:
210-
self._logger.error(f"Failed to get tools from MCP server {server.mcp_server_name}: {ex}")
211-
return []
210+
self._logger.error(
211+
f"Failed to get tools from MCP server {server.mcp_server_name}: {ex}"
212+
)
213+
return []

libraries/microsoft-agents-a365-tooling-extensions-agentframework/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ def build_version():
2828

2929
setup(
3030
version=VERSION,
31-
)
31+
)

0 commit comments

Comments
 (0)