Skip to content

Commit e295998

Browse files
committed
fix: linting
1 parent 5d3eb17 commit e295998

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

src/strands/tools/mcp/mcp_client.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def _handle_tool_execution_error(self, tool_use_id: str, exception: Exception) -
250250

251251
def _handle_tool_result(self, tool_use_id: str, call_tool_result: MCPCallToolResult) -> ToolResult:
252252
"""Maps MCP tool result to the agent's ToolResult format.
253-
253+
254254
This method processes the content from the MCP tool call result and converts it to the format
255255
expected by the agent framework. If structured content is available in the MCP tool result,
256256
it will be appended as the last item in the content array of the returned ToolResult.
@@ -271,9 +271,7 @@ def _handle_tool_result(self, tool_use_id: str, call_tool_result: MCPCallToolRes
271271
]
272272

273273
if call_tool_result.structuredContent:
274-
mapped_content.append({
275-
"json": call_tool_result.structuredContent
276-
})
274+
mapped_content.append({"json": call_tool_result.structuredContent})
277275

278276
status: ToolResultStatus = "error" if call_tool_result.isError else "success"
279277
self._log_debug_with_thread("tool execution completed with status: %s", status)

tests/strands/tools/mcp/test_mcp_client.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,7 @@ def test_call_tool_sync_with_structured_content(mock_transport, mock_session):
144144
mock_content = MCPTextContent(type="text", text="Test message")
145145
structured_content = {"result": 42, "status": "completed"}
146146
mock_session.call_tool.return_value = MCPCallToolResult(
147-
isError=False,
148-
content=[mock_content],
149-
structuredContent=structured_content
147+
isError=False, content=[mock_content], structuredContent=structured_content
150148
)
151149

152150
with MCPClient(mock_transport["transport_callable"]) as client:
@@ -217,11 +215,7 @@ async def test_call_tool_async_with_structured_content(mock_transport, mock_sess
217215
"""Test that call_tool_async correctly handles structured content."""
218216
mock_content = MCPTextContent(type="text", text="Test message")
219217
structured_content = {"result": 42, "status": "completed"}
220-
mock_result = MCPCallToolResult(
221-
isError=False,
222-
content=[mock_content],
223-
structuredContent=structured_content
224-
)
218+
mock_result = MCPCallToolResult(isError=False, content=[mock_content], structuredContent=structured_content)
225219
mock_session.call_tool.return_value = mock_result
226220

227221
with MCPClient(mock_transport["transport_callable"]) as client:

tests_integ/echo_server.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
Run this file directly to start the echo server:
1515
$ python echo_server.py
1616
"""
17+
1718
from typing import Dict, Any
1819

1920
from mcp.server import FastMCP

tests_integ/test_mcp_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def test_mcp_client():
9494
arguments={"to_echo": "STRUCTURED_DATA_TEST"},
9595
)
9696

97-
assert result['content'][-1]['json']['result'] == {"echoed": "STRUCTURED_DATA_TEST"}
97+
assert result["content"][-1]["json"]["result"] == {"echoed": "STRUCTURED_DATA_TEST"}
9898

9999

100100
def test_can_reuse_mcp_client():

0 commit comments

Comments
 (0)