| 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\Extension\Skills\Client; |
| 15: | |
| 16: | use Nexus\Mcp\Client\Exception\ServerCapabilityNotSupportedException; |
| 17: | use Nexus\Mcp\Core\Schema\Cursor; |
| 18: | use Nexus\Mcp\Core\Schema\Result\InputRequiredResult; |
| 19: | use Nexus\Mcp\Core\Schema\Result\InputResponse; |
| 20: | use Nexus\Mcp\Extension\Skills\Client\Exception\SkillVerificationFailedException; |
| 21: | use Nexus\Mcp\Extension\Skills\Schema\Result\ListSkillsResult; |
| 22: | use Nexus\Mcp\Extension\Skills\Schema\Result\ReadResourceDirectoryResult; |
| 23: | use Nexus\Mcp\Extension\Skills\Schema\Skill; |
| 24: | |
| 25: | /** |
| 26: | * Client-side surface of the skills extension. |
| 27: | */ |
| 28: | interface SkillClientInterface |
| 29: | { |
| 30: | /** |
| 31: | * One page of the skills listed by the server, which may serve others without listing them. |
| 32: | * |
| 33: | * @throws ServerCapabilityNotSupportedException |
| 34: | */ |
| 35: | public function listSkills(?Cursor $cursor = null): ListSkillsResult; |
| 36: | |
| 37: | /** |
| 38: | * The current entry of one skill, whether or not the server lists it. |
| 39: | * |
| 40: | * @param non-empty-string $uri URI of the skill's `SKILL.md` |
| 41: | * |
| 42: | * @throws ServerCapabilityNotSupportedException |
| 43: | */ |
| 44: | public function getSkill(string $uri): Skill; |
| 45: | |
| 46: | /** |
| 47: | * Reads one file of a skill and returns its bytes once they match the entry, or the server's request for |
| 48: | * input. Call it only when the file is needed, since a host must not fetch a skill's files ahead of use. |
| 49: | * |
| 50: | * @param non-empty-string $uri |
| 51: | * @param null|array<int|non-empty-string, InputResponse> $inputResponses |
| 52: | * |
| 53: | * @throws SkillVerificationFailedException |
| 54: | */ |
| 55: | public function readSkillFile(Skill $skill, string $uri, ?array $inputResponses = null, ?string $requestState = null): InputRequiredResult|string; |
| 56: | |
| 57: | /** |
| 58: | * One page of the direct children of a directory resource. |
| 59: | * |
| 60: | * @param non-empty-string $uri URI of the directory, written without a trailing slash |
| 61: | * |
| 62: | * @throws ServerCapabilityNotSupportedException |
| 63: | */ |
| 64: | public function readDirectory(string $uri, ?Cursor $cursor = null): ReadResourceDirectoryResult; |
| 65: | } |
| 66: |