From 4334420625eede0953317b844cbf59678b4d5bd9 Mon Sep 17 00:00:00 2001 From: Matthieu Date: Wed, 27 May 2026 09:41:29 +0200 Subject: [PATCH] =?UTF-8?q?fix(mcp)=20:=20typer=20les=20=C3=A9l=C3=A9ments?= =?UTF-8?q?=20des=20params=20tableaux=20d'IDs=20(items:=20integer)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Les params tableaux (tagIds, collaboratorIds) des tools create-task, update-task, list-tasks, create-time-entry et update-time-entry généraient un schéma { type: [array, null] } sans clé items : aucune contrainte sur le type des éléments, d'où des IDs pouvant transiter en string. Ajout d'un docblock @param int[] sur chaque __invoke pour que le SchemaGenerator du SDK MCP produise items: { type: integer }, ce qui force la validation à n'accepter que des entiers. --- src/Mcp/Tool/Task/CreateTaskTool.php | 4 ++++ src/Mcp/Tool/Task/ListTasksTool.php | 3 +++ src/Mcp/Tool/Task/UpdateTaskTool.php | 4 ++++ src/Mcp/Tool/TimeEntry/CreateTimeEntryTool.php | 3 +++ src/Mcp/Tool/TimeEntry/UpdateTimeEntryTool.php | 3 +++ 5 files changed, 17 insertions(+) diff --git a/src/Mcp/Tool/Task/CreateTaskTool.php b/src/Mcp/Tool/Task/CreateTaskTool.php index 7919819..651ef11 100644 --- a/src/Mcp/Tool/Task/CreateTaskTool.php +++ b/src/Mcp/Tool/Task/CreateTaskTool.php @@ -41,6 +41,10 @@ class CreateTaskTool private readonly CalDavService $calDavService, ) {} + /** + * @param int[] $tagIds IDs of the tags to attach + * @param int[] $collaboratorIds IDs of the collaborators to attach + */ public function __invoke( int $projectId, string $title, diff --git a/src/Mcp/Tool/Task/ListTasksTool.php b/src/Mcp/Tool/Task/ListTasksTool.php index 88096ef..9722ad0 100644 --- a/src/Mcp/Tool/Task/ListTasksTool.php +++ b/src/Mcp/Tool/Task/ListTasksTool.php @@ -18,6 +18,9 @@ class ListTasksTool private readonly Security $security, ) {} + /** + * @param int[] $tagIds IDs of the tags to filter by + */ public function __invoke( ?int $projectId = null, ?int $statusId = null, diff --git a/src/Mcp/Tool/Task/UpdateTaskTool.php b/src/Mcp/Tool/Task/UpdateTaskTool.php index 82c0c6b..09c53dc 100644 --- a/src/Mcp/Tool/Task/UpdateTaskTool.php +++ b/src/Mcp/Tool/Task/UpdateTaskTool.php @@ -38,6 +38,10 @@ class UpdateTaskTool private readonly CalDavService $calDavService, ) {} + /** + * @param int[] $tagIds IDs of the tags to attach + * @param int[] $collaboratorIds IDs of the collaborators to attach + */ public function __invoke( int $id, ?string $title = null, diff --git a/src/Mcp/Tool/TimeEntry/CreateTimeEntryTool.php b/src/Mcp/Tool/TimeEntry/CreateTimeEntryTool.php index 31b5832..5f5a223 100644 --- a/src/Mcp/Tool/TimeEntry/CreateTimeEntryTool.php +++ b/src/Mcp/Tool/TimeEntry/CreateTimeEntryTool.php @@ -33,6 +33,9 @@ class CreateTimeEntryTool private readonly Security $security, ) {} + /** + * @param int[] $tagIds IDs of the tags to attach + */ public function __invoke( int $userId, string $startedAt, diff --git a/src/Mcp/Tool/TimeEntry/UpdateTimeEntryTool.php b/src/Mcp/Tool/TimeEntry/UpdateTimeEntryTool.php index 3222f87..c164fc9 100644 --- a/src/Mcp/Tool/TimeEntry/UpdateTimeEntryTool.php +++ b/src/Mcp/Tool/TimeEntry/UpdateTimeEntryTool.php @@ -30,6 +30,9 @@ class UpdateTimeEntryTool private readonly Security $security, ) {} + /** + * @param int[] $tagIds IDs of the tags to attach + */ public function __invoke( int $id, ?string $title = null,