|
| 1 | +<?php |
| 2 | + |
| 3 | +/* |
| 4 | + * This file is part of the official PHP MCP SDK. |
| 5 | + * |
| 6 | + * A collaboration between Symfony and the PHP Foundation. |
| 7 | + * |
| 8 | + * For the full copyright and license information, please view the LICENSE |
| 9 | + * file that was distributed with this source code. |
| 10 | + */ |
| 11 | + |
| 12 | +namespace Mcp\Capability\Attribute; |
| 13 | + |
| 14 | +use Mcp\Schema\Annotations; |
| 15 | + |
| 16 | +/** |
| 17 | + * Marks a PHP class as representing or handling a specific MCP Resource instance. |
| 18 | + * Used primarily for the 'resources/list' discovery. |
| 19 | + * |
| 20 | + * @author Kyrian Obikwelu <[email protected]> |
| 21 | + */ |
| 22 | +#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_CLASS)] |
| 23 | +final class McpResource |
| 24 | +{ |
| 25 | + /** |
| 26 | + * @param string $uri The specific URI identifying this resource instance. Must be unique within the server. |
| 27 | + * @param ?string $name A human-readable name for this resource. If null, a default might be generated from the method name. |
| 28 | + * @param ?string $description An optional description of the resource. Defaults to class DocBlock summary. |
| 29 | + * @param ?string $mimeType the MIME type, if known and constant for this resource |
| 30 | + * @param ?int $size the size in bytes, if known and constant |
| 31 | + * @param Annotations|null $annotations optional annotations describing the resource |
| 32 | + */ |
| 33 | + public function __construct( |
| 34 | + public string $uri, |
| 35 | + public ?string $name = null, |
| 36 | + public ?string $description = null, |
| 37 | + public ?string $mimeType = null, |
| 38 | + public ?int $size = null, |
| 39 | + public ?Annotations $annotations = null, |
| 40 | + ) { |
| 41 | + } |
| 42 | +} |
0 commit comments