Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fastapi_mcp/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mcp_execute_api_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down