Skip to content

Commit e22096e

Browse files
ampagentjbrooksuk
andcommitted
Fix MCP component group analysis
Type the eager-loaded component relation so Larastan resolves the enabled scope, matching the REST API callback. Amp-Thread-ID: https://ampcode.com/threads/T-01a12f2a-6822-7518-8bf0-17f8250cf197 Co-authored-by: James Brooks <jbrooksuk@me.com>
1 parent 57b44a8 commit e22096e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎src/Mcp/Tools/ComponentGroups/ListComponentGroups.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@
55
use Cachet\Concerns\ChecksApiAuthentication;
66
use Cachet\Mcp\Concerns\InteractsWithPagination;
77
use Cachet\Mcp\Concerns\PresentsResources;
8+
use Cachet\Models\Component;
89
use Cachet\Models\ComponentGroup;
910
use Illuminate\Contracts\JsonSchema\JsonSchema;
11+
use Illuminate\Database\Eloquent\Relations\HasMany;
1012
use Laravel\Mcp\Request;
1113
use Laravel\Mcp\Response;
1214
use Laravel\Mcp\ResponseFactory;
@@ -40,7 +42,8 @@ public function handle(Request $request): ResponseFactory
4042
{
4143
$groups = ComponentGroup::query()
4244
->visible($this->isAuthenticated())
43-
->with(['components' => function ($query): void {
45+
->with(['components' => function (HasMany $query): void {
46+
/** @var HasMany<Component, ComponentGroup> $query */
4447
if (! $this->isAuthenticated()) {
4548
$query->enabled();
4649
}

0 commit comments

Comments
 (0)