Skip to content

Commit a07ff28

Browse files
authored
πŸ› fix mcp tool validate, adapted for fastmcp version 2.12.0. #1395
2 parents e77b3ef + 6ed7898 commit a07ff28

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

β€Žbackend/services/tool_configuration_service.pyβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ async def _call_mcp_tool(
469469
name=tool_name,
470470
arguments=inputs
471471
)
472-
return result[0].text
472+
return result.content[0].text
473473

474474

475475
async def _validate_mcp_tool_nexent(

β€Žtest/backend/services/test_tool_configuration_service.pyβ€Ž

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,10 +1139,12 @@ async def test_call_mcp_tool_success(self, mock_client_cls):
11391139
mock_client.__aexit__.return_value = None
11401140
mock_client.is_connected.return_value = True
11411141

1142-
# Mock tool result
1142+
# Mock tool result structure to match what _call_mcp_tool expects
1143+
mock_content_item = Mock()
1144+
mock_content_item.text = "test result"
11431145
mock_result = Mock()
1144-
mock_result.text = "test result"
1145-
mock_client.call_tool.return_value = [mock_result]
1146+
mock_result.content = [mock_content_item]
1147+
mock_client.call_tool.return_value = mock_result
11461148

11471149
mock_client_cls.return_value = mock_client
11481150

0 commit comments

Comments
Β (0)