feat: ability and integration infrastructure

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:
2026-09-25 15:27:08 +02:00
co-authored by Claude Opus 5.5
parent f69efcb953
commit 3b7fabf17a
7 changed files with 397 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
<?php
declare(strict_types=1);
namespace LIT\MCP\Abilities;
use WP_Error;
/**
* Factory for the error objects abilities return. The MCP adapter turns them
* into tool results with isError: true.
*/
final class Errors
{
public static function forbidden(string $message): WP_Error
{
return new WP_Error('lit_forbidden', $message, ['status' => 403]);
}
/** @param array<string, string> $fields */
public static function invalidInput(string $message, array $fields = []): WP_Error
{
return new WP_Error('lit_validation_failed', $message, ['status' => 400, 'fields' => $fields]);
}
public static function notFound(string $message): WP_Error
{
return new WP_Error('lit_not_found', $message, ['status' => 404]);
}
public static function internal(): WP_Error
{
return new WP_Error(
'lit_internal_error',
'Interner Fehler bei der Ausführung. Details stehen im PHP-Error-Log der Website.',
['status' => 500]
);
}
}