Add KanbanGit MCP v0.1

This commit is contained in:
2026-04-20 20:36:59 +02:00
parent bf0e50464a
commit cd574ec26b
15 changed files with 1289 additions and 6 deletions
+67
View File
@@ -0,0 +1,67 @@
<?php
namespace App\Mcp\Tools;
use App\Actions\Tickets\UpdateProjectTicket;
use App\Mcp\Support\KanbanGitMcp;
use Illuminate\Contracts\JsonSchema\JsonSchema;
use Illuminate\JsonSchema\Types\Type;
use Laravel\Mcp\Request;
use Laravel\Mcp\Response;
use Laravel\Mcp\ResponseFactory;
use Laravel\Mcp\Server\Attributes\Description;
use Laravel\Mcp\Server\Attributes\Name;
use Laravel\Mcp\Server\Tool;
use Laravel\Mcp\Server\Tools\Annotations\IsDestructive;
#[Name('update_ticket_description')]
#[Description('Update only a ticket description while preserving all other ticket fields. Requires project write permission.')]
#[IsDestructive(false)]
class UpdateTicketDescription extends Tool
{
public function __construct(
private readonly KanbanGitMcp $kanbanGitMcp,
private readonly UpdateProjectTicket $updateProjectTicket,
) {}
public function handle(Request $request): Response|ResponseFactory
{
$validated = $request->validate([
'description' => ['nullable', 'string'],
'ticket_id' => ['required', 'integer'],
]);
$user = $this->kanbanGitMcp->user($request);
$ticket = $this->kanbanGitMcp->ticketForWrite($user, (int) $validated['ticket_id']);
$payload = [
...$this->kanbanGitMcp->updatePayload($ticket),
'description' => $validated['description'] ?? null,
];
$wasUpdated = $this->updateProjectTicket->handle($ticket, $user, $payload);
return Response::structured([
'data' => $this->kanbanGitMcp->ticketPayload($ticket->fresh()),
'meta' => [
'message' => $wasUpdated
? "{$ticket->ticket_key} description was updated."
: 'No ticket changes were detected.',
],
]);
}
/**
* @return array<string, Type>
*/
public function schema(JsonSchema $schema): array
{
return [
'description' => $schema->string()
->nullable()
->description('New ticket description. Pass null to clear it.'),
'ticket_id' => $schema->integer()
->description('Ticket ID.')
->required(),
];
}
}