From c79c7bf22e413792bc9907b090d8007bbad9ecd3 Mon Sep 17 00:00:00 2001 From: Koda Date: Thu, 23 Apr 2026 19:46:42 +0000 Subject: [PATCH] Validate status selector for list tickets tool --- app/Mcp/Tools/ListTicketsByStatus.php | 4 +++- tests/Feature/Mcp/KanbanGitMcpTest.php | 9 +++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/app/Mcp/Tools/ListTicketsByStatus.php b/app/Mcp/Tools/ListTicketsByStatus.php index 581ca6c..312370e 100644 --- a/app/Mcp/Tools/ListTicketsByStatus.php +++ b/app/Mcp/Tools/ListTicketsByStatus.php @@ -31,7 +31,9 @@ class ListTicketsByStatus extends Tool 'project_id' => ['nullable', 'integer'], 'status_name' => ['nullable', 'string'], 'status_slug' => ['nullable', 'string'], - 'ticket_status_id' => ['nullable', 'integer'], + 'ticket_status_id' => ['nullable', 'integer', 'required_without_all:status_slug,status_name'], + ], [ + 'ticket_status_id.required_without_all' => 'Provide ticket_status_id, status_slug, or status_name.', ]); $user = $this->kanbanGitMcp->user($request); diff --git a/tests/Feature/Mcp/KanbanGitMcpTest.php b/tests/Feature/Mcp/KanbanGitMcpTest.php index 75517d4..bcc56f7 100644 --- a/tests/Feature/Mcp/KanbanGitMcpTest.php +++ b/tests/Feature/Mcp/KanbanGitMcpTest.php @@ -319,6 +319,15 @@ class KanbanGitMcpTest extends TestCase ->etc()); } + public function test_list_tickets_by_status_requires_a_status_selector(): void + { + $user = User::factory()->create(); + + KanbanGitServer::actingAs($user) + ->tool(ListTicketsByStatus::class) + ->assertHasErrors(['Provide ticket_status_id, status_slug, or status_name.']); + } + public function test_ambiguous_status_name_returns_mcp_error(): void { $user = User::factory()->create();