Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCrwHHnGCB5XH968Nxokqw
35 lines
1.0 KiB
PHP
35 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Mcp\Tools;
|
|
|
|
use App\Delivery\EventActions;
|
|
use App\Models\Event;
|
|
use App\Presenters\EventPresenter;
|
|
use Illuminate\Contracts\JsonSchema\JsonSchema;
|
|
use Laravel\Mcp\Request;
|
|
use Laravel\Mcp\Response;
|
|
use Laravel\Mcp\ResponseFactory;
|
|
|
|
class MarkDone extends AgentTool
|
|
{
|
|
protected string $name = 'mark_done';
|
|
|
|
protected string $description = '«Сделано»: закрыть событие любого источника — как кнопка в инбоксе. Уже закрытое не трогается.';
|
|
|
|
public function __construct(private readonly EventActions $actions) {}
|
|
|
|
public function schema(JsonSchema $schema): array
|
|
{
|
|
return ['id' => $schema->integer()->required()];
|
|
}
|
|
|
|
public function handle(Request $request): Response|ResponseFactory
|
|
{
|
|
return $this->withEvent($request, function (Event $event) {
|
|
$this->actions->done($event);
|
|
|
|
return $this->respond(EventPresenter::forUser($event->fresh('source')));
|
|
});
|
|
}
|
|
}
|