From f69f4d608821a54b562705df674f0f710f863b51 Mon Sep 17 00:00:00 2001 From: shiraayal-tadata Date: Thu, 24 Apr 2025 15:47:00 +0300 Subject: [PATCH 1/2] remove indent in server results --- fastapi_mcp/server.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastapi_mcp/server.py b/fastapi_mcp/server.py index f5c4fc6..17caf65 100644 --- a/fastapi_mcp/server.py +++ b/fastapi_mcp/server.py @@ -422,7 +422,7 @@ async def _execute_api_tool( # TODO: Better typing for the AsyncClientProtocol. It should return a ResponseProtocol that has a json() method that returns a dict/list/etc. try: result = response.json() - result_text = json.dumps(result, indent=2, ensure_ascii=False) + result_text = json.dumps(result, indent=None, ensure_ascii=False) except json.JSONDecodeError: if hasattr(response, "text"): result_text = response.text From 462678197a13ff17d3fb593353e1bb302a61aa4f Mon Sep 17 00:00:00 2001 From: shiraayal-tadata Date: Thu, 24 Apr 2025 15:49:44 +0300 Subject: [PATCH 2/2] fix test for new result format --- tests/test_mcp_execute_api_tool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_mcp_execute_api_tool.py b/tests/test_mcp_execute_api_tool.py index cc05d34..6dd8599 100644 --- a/tests/test_mcp_execute_api_tool.py +++ b/tests/test_mcp_execute_api_tool.py @@ -37,7 +37,7 @@ async def test_execute_api_tool_success(simple_fastapi_app: FastAPI): # Verify the result assert len(result) == 1 assert isinstance(result[0], TextContent) - assert result[0].text == '{\n "id": 1,\n "name": "Test Item"\n}' + assert result[0].text == '{"id": 1, "name": "Test Item"}' # Verify the HTTP client was called correctly mock_client.get.assert_called_once_with(