integer('id')->description('ID of the task to update.')->required() ->raw('params', ['type' => 'object', 'description' => 'Key-value pairs of fields to update. Example: {"headline": "New title", "status": 3}'])->required(); } /** * Handle the tool request. */ public function handle(array $arguments): ToolResult { $id = (int) ($arguments['id'] ?? 0); $params = ($arguments['params'] ?? null); if (is_array($params) && ! empty($params) && isset($params[0]) && is_array($params[0])) { $params = $params[0]; } if (! is_array($params)) { return ToolResult::error('The params parameter is not a valid object. Provide key-value pairs.'); } if ($this->ticketsService->patch($id, $params)) { return ToolResult::text('Task updated successfully.'); } return ToolResult::error('Failed to update task.'); } }