Skip to content
This repository was archived by the owner on Nov 12, 2025. It is now read-only.
Open
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
3 changes: 3 additions & 0 deletions src/Service/ResponseFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Ecourty\McpServerBundle\HttpFoundation\JsonRpcResponse;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer;
use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\SerializerInterface;

/**
Expand Down Expand Up @@ -46,6 +47,8 @@ private function createResponse(JsonRpcResponse $response): JsonResponse
{
$json = $this->serializer->serialize($response, 'json', [
AbstractObjectNormalizer::SKIP_NULL_VALUES => true,
AbstractObjectNormalizer::PRESERVE_EMPTY_OBJECTS => true,
Serializer::EMPTY_ARRAY_AS_OBJECT => true,
]);

return JsonResponse::fromJsonString($json, JsonResponse::HTTP_OK);
Expand Down
2 changes: 1 addition & 1 deletion tests/Controller/EntrypointControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function testToolList(): void
], $tools[0]['annotations']);

$this->assertArrayHasKey('inputSchema', $tools[1]);
$this->assertSame([], $tools[1]['inputSchema']);
$this->assertEmpty($tools[1]['inputSchema']);

$this->assertArrayHasKey('inputSchema', $tools[2]);
$this->assertSame([
Expand Down