Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCrwHHnGCB5XH968Nxokqw
33 lines
1.3 KiB
PHP
33 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Mcp\Tools;
|
|
|
|
use App\Presenters\ProfilePresenter;
|
|
use App\Users\ProfileUpdater;
|
|
use Illuminate\Contracts\JsonSchema\JsonSchema;
|
|
use Laravel\Mcp\Request;
|
|
use Laravel\Mcp\ResponseFactory;
|
|
|
|
class UpdateProfile extends AgentTool
|
|
{
|
|
protected string $name = 'update_profile';
|
|
|
|
protected string $description = 'Поменять часовой пояс и/или тихие часы пользователя — любое подмножество полей. Тихие часы должны переходить через полночь: quiet_end раньше quiet_start.';
|
|
|
|
public function __construct(private readonly ProfileUpdater $profile) {}
|
|
|
|
public function schema(JsonSchema $schema): array
|
|
{
|
|
return [
|
|
'tz' => $schema->string()->description('Идентификатор зоны, напр. Europe/Belgrade'),
|
|
'quiet_start' => $schema->string()->description('HH:MM, начало тихих часов'),
|
|
'quiet_end' => $schema->string()->description('HH:MM, конец тихих часов'),
|
|
];
|
|
}
|
|
|
|
public function handle(Request $request): ResponseFactory
|
|
{
|
|
return $this->respond(ProfilePresenter::present($this->profile->update($this->user(), $request->all())));
|
|
}
|
|
}
|