feat: group tools by integration with inherited group mode and "nur lesen" switch
Tools tab shows one block per integration with a group mode (inherited by its tools) and a read-only switch that disables all non-readonly abilities of the group. ExposurePolicy resolves tool override > group override > tool default; lit/guide keeps its default, direct-only tools fall back to direct under a group "indirekt". Group entries live in lit_mcp_exposure under "@group:<id>" and "@readonly:<id>"; the old flat format stays valid. The ability->group map comes lazily from IntegrationRegistry (Divi is not loaded at plugins_loaded). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -98,4 +98,24 @@ final class InstructionsBuilderTest extends TestCase
|
||||
|
||||
self::assertStringContainsString('lit-menu-list', $text);
|
||||
}
|
||||
|
||||
public function testGroupDisabledAndReadonlyToolsAreNotListedAsDirect(): void
|
||||
{
|
||||
$write = $this->ability('lit/divi-update', true);
|
||||
$write->allows('annotations')->andReturn(['readonly' => false]);
|
||||
$read = $this->ability('lit/divi-outline', true);
|
||||
$read->allows('annotations')->andReturn(['readonly' => true]);
|
||||
$divi = Mockery::mock(Integration::class);
|
||||
$divi->allows('id')->andReturn('divi');
|
||||
$divi->allows('isAvailable')->andReturn(true);
|
||||
$divi->allows('abilities')->andReturn([$write, $read]);
|
||||
$core = $this->coreWith($this->ability('lit/guide', true), $this->ability('lit/menu-list', true));
|
||||
$registry = new IntegrationRegistry($core, $divi);
|
||||
$policy = (new ExposurePolicy(['@group:core' => 'disabled', '@readonly:divi' => true]))
|
||||
->withGroups($registry->groupMap());
|
||||
|
||||
$text = (new InstructionsBuilder($registry, null, $policy))->build();
|
||||
|
||||
self::assertStringContainsString('Direkt aufrufbare Tools: lit-guide, lit-divi-outline.', $text);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user