| 1: | <?php |
| 2: | |
| 3: | declare(strict_types=1); |
| 4: | |
| 5: | /** |
| 6: | * This file is part of the Nexus MCP SDK package. |
| 7: | * |
| 8: | * (c) 2026 John Paul E. Balandan, CPA <paulbalandan@gmail.com> |
| 9: | * |
| 10: | * For the full copyright and license information, please view |
| 11: | * the LICENSE file that was distributed with this source code. |
| 12: | */ |
| 13: | |
| 14: | namespace Nexus\Mcp\Core\Extension; |
| 15: | |
| 16: | use Nexus\Mcp\Core\Handler\AbstractContext; |
| 17: | use Nexus\Mcp\Core\Handler\NotificationHandlerInterface; |
| 18: | use Nexus\Mcp\Core\Handler\RequestHandlerInterface; |
| 19: | use Nexus\Mcp\Core\Schema\JsonRpc\JsonRpcNotification; |
| 20: | use Nexus\Mcp\Core\Schema\JsonRpc\JsonRpcRequest; |
| 21: | use Nexus\Mcp\Core\Schema\Result; |
| 22: | |
| 23: | /** |
| 24: | * One MCP extension declaration (SEP-2133). |
| 25: | * |
| 26: | * @template TContext of AbstractContext |
| 27: | * |
| 28: | * @see https://modelcontextprotocol.io/seps/2133-extensions |
| 29: | */ |
| 30: | interface ExtensionInterface |
| 31: | { |
| 32: | /** |
| 33: | * The `{vendor-prefix}/{name}` capability identifier, e.g. "io.modelcontextprotocol/tasks". |
| 34: | * |
| 35: | * @return non-empty-string |
| 36: | */ |
| 37: | public function getIdentifier(): string; |
| 38: | |
| 39: | /** |
| 40: | * Settings advertised under `capabilities.extensions[identifier]`, empty meaning supported with none. |
| 41: | * |
| 42: | * @return array<string, mixed> |
| 43: | */ |
| 44: | public function getSettings(): array; |
| 45: | |
| 46: | /** |
| 47: | * @return list<class-string<JsonRpcRequest<non-empty-string>>> |
| 48: | */ |
| 49: | public function getRequests(): array; |
| 50: | |
| 51: | /** |
| 52: | * @return list<class-string<JsonRpcNotification<non-empty-string>>> |
| 53: | */ |
| 54: | public function getNotifications(): array; |
| 55: | |
| 56: | /** |
| 57: | * Handlers for `getRequests()`, keyed by the method each class declares. |
| 58: | * |
| 59: | * @return array<non-empty-string, RequestHandlerInterface<non-empty-string, Result, TContext>> |
| 60: | */ |
| 61: | public function getRequestHandlers(): array; |
| 62: | |
| 63: | /** |
| 64: | * Handlers for `getNotifications()`, keyed by the method each class declares. |
| 65: | * |
| 66: | * @return array<non-empty-string, NotificationHandlerInterface<non-empty-string>> |
| 67: | */ |
| 68: | public function getNotificationHandlers(): array; |
| 69: | } |
| 70: |