php-agentic/Mcp/Tools/Agent/Plan/PlanUpdateStatus.php
Claude 3f905583a8
Some checks failed
CI / tests (push) Failing after 1m9s
chore: fix pint code style and add test config
Add phpunit.xml for standalone test execution.
Apply Laravel Pint formatting fixes across all source files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 03:50:09 +00:00

72 lines
1.7 KiB
PHP

<?php
declare(strict_types=1);
namespace Core\Mod\Agentic\Mcp\Tools\Agent\Plan;
use Core\Mod\Agentic\Mcp\Tools\Agent\AgentTool;
use Core\Mod\Agentic\Models\AgentPlan;
/**
* 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,
],
]);
}
}