Updates all classes to use the new modular namespace convention. Adds Service/ layer with Core\Service\Agentic for service definition. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
72 lines
1.7 KiB
PHP
72 lines
1.7 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Core\Mod\Agentic\Mcp\Tools\Agent\Plan;
|
|
|
|
use Core\Mod\Agentic\Models\AgentPlan;
|
|
use Core\Mod\Agentic\Mcp\Tools\Agent\AgentTool;
|
|
|
|
/**
|
|
* Update the status of a plan.
|
|
*/
|
|
class PlanUpdateStatus extends AgentTool
|
|
{
|
|
protected string $category = 'plan';
|
|
|
|
protected array $scopes = ['write'];
|
|
|
|
public function name(): string
|
|
{
|
|
return 'plan_update_status';
|
|
}
|
|
|
|
public function description(): string
|
|
{
|
|
return 'Update the status of a plan';
|
|
}
|
|
|
|
public function inputSchema(): array
|
|
{
|
|
return [
|
|
'type' => 'object',
|
|
'properties' => [
|
|
'slug' => [
|
|
'type' => 'string',
|
|
'description' => 'Plan slug identifier',
|
|
],
|
|
'status' => [
|
|
'type' => 'string',
|
|
'description' => 'New status',
|
|
'enum' => ['draft', 'active', 'paused', 'completed'],
|
|
],
|
|
],
|
|
'required' => ['slug', 'status'],
|
|
];
|
|
}
|
|
|
|
public function handle(array $args, array $context = []): array
|
|
{
|
|
try {
|
|
$slug = $this->require($args, 'slug');
|
|
$status = $this->require($args, 'status');
|
|
} catch (\InvalidArgumentException $e) {
|
|
return $this->error($e->getMessage());
|
|
}
|
|
|
|
$plan = AgentPlan::where('slug', $slug)->first();
|
|
|
|
if (! $plan) {
|
|
return $this->error("Plan not found: {$slug}");
|
|
}
|
|
|
|
$plan->update(['status' => $status]);
|
|
|
|
return $this->success([
|
|
'plan' => [
|
|
'slug' => $plan->slug,
|
|
'status' => $plan->fresh()->status,
|
|
],
|
|
]);
|
|
}
|
|
}
|