feat: MCP tools for events (list/get/create/update/delete/done/ack); EventRules shared by /api and manual
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BCrwHHnGCB5XH968Nxokqw
This commit is contained in:
29
core/app/Mcp/Tools/GetEvent.php
Normal file
29
core/app/Mcp/Tools/GetEvent.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Mcp\Tools;
|
||||
|
||||
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;
|
||||
use Laravel\Mcp\Server\Tools\Annotations\IsReadOnly;
|
||||
|
||||
#[IsReadOnly]
|
||||
class GetEvent extends AgentTool
|
||||
{
|
||||
protected string $name = 'get_event';
|
||||
|
||||
protected string $description = 'Одно событие пользователя целиком по id.';
|
||||
|
||||
public function schema(JsonSchema $schema): array
|
||||
{
|
||||
return ['id' => $schema->integer()->required()];
|
||||
}
|
||||
|
||||
public function handle(Request $request): Response|ResponseFactory
|
||||
{
|
||||
return $this->withEvent($request, fn (Event $event) => $this->respond(EventPresenter::forUser($event)));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user