refactor: annotation presets (L5)
The 41 abilities return Annotations::read(), ::write(idempotent) or ::destructive(idempotent) instead of hand-written arrays (same arrays, same key order). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01At3V6SjwbMe6eMzVGW3Hs7
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace LIT\MCP\Abilities;
|
||||
|
||||
/**
|
||||
* The MCP annotations of an ability (Ability::annotations()), in three presets. "readonly"
|
||||
* drives the "nur lesen" group switch (ExposurePolicy::disabledByReadonly()) and, with
|
||||
* "destructive", the Art column of the Tools tab (ruling S47).
|
||||
*/
|
||||
final class Annotations
|
||||
{
|
||||
/** @return array{readonly: bool, destructive: bool, idempotent: bool} Reads only. */
|
||||
public static function read(): array
|
||||
{
|
||||
return ['readonly' => true, 'destructive' => false, 'idempotent' => true];
|
||||
}
|
||||
|
||||
/** @return array{readonly: bool, destructive: bool, idempotent: bool} Writes, removes or overwrites nothing. */
|
||||
public static function write(bool $idempotent): array
|
||||
{
|
||||
return ['readonly' => false, 'destructive' => false, 'idempotent' => $idempotent];
|
||||
}
|
||||
|
||||
/** @return array{readonly: bool, destructive: bool, idempotent: bool} Removes or overwrites something. */
|
||||
public static function destructive(bool $idempotent): array
|
||||
{
|
||||
return ['readonly' => false, 'destructive' => true, 'idempotent' => $idempotent];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user