fix(mcp) : return CallToolResult to prevent structuredContent serialization issue
Tools now return CallToolResult directly instead of Content arrays, preventing the MCP SDK from auto-generating structuredContent as a JSON array (which Claude Code rejects — expects a JSON object/record). Also adds Accept header to test helpers and SSE response parsing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,7 @@ use App\Repository\PieceRepository;
|
||||
use App\Repository\ProductRepository;
|
||||
use App\Repository\SiteRepository;
|
||||
use Mcp\Capability\Attribute\McpTool;
|
||||
use Mcp\Schema\Result\CallToolResult;
|
||||
|
||||
#[McpTool(
|
||||
name: 'search_inventory',
|
||||
@@ -31,7 +32,7 @@ class SearchInventoryTool
|
||||
private readonly ConstructeurRepository $constructeurs,
|
||||
) {}
|
||||
|
||||
public function __invoke(string $query, string $types = '', int $limit = 20): array
|
||||
public function __invoke(string $query, string $types = '', int $limit = 20): CallToolResult
|
||||
{
|
||||
$query = trim($query);
|
||||
if ('' === $query) {
|
||||
|
||||
Reference in New Issue
Block a user