Add title parameter to Builder::addResource() and addResourceTemplate() (#310)
#301 added the `title` field to the `Resource`/`ResourceTemplate` schema classes and the `McpResource`/`McpResourceTemplate` attributes, but the manual registration methods on `Builder` were never updated — so manual registration could not set a resource title, unlike tools and prompts. Add a `$title` parameter between `$name` and `$description` (matching `addTool()`/`addPrompt()`) and propagate it through `ArrayLoader` when constructing the `Resource`/`ResourceTemplate` objects. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a820497b62
commit
1300d2ee7d
1 changed files with 84 additions and 0 deletions
|
|
@ -56,6 +56,7 @@ final class ArrayLoader implements LoaderInterface
|
|||
* handler: Handler,
|
||||
* uri: string,
|
||||
* name: ?string,
|
||||
* title: ?string,
|
||||
* description: ?string,
|
||||
* mimeType: ?string,
|
||||
* size: int|null,
|
||||
|
|
@ -67,6 +68,7 @@ final class ArrayLoader implements LoaderInterface
|
|||
* handler: Handler,
|
||||
* uriTemplate: string,
|
||||
* name: ?string,
|
||||
* title: ?string,
|
||||
* description: ?string,
|
||||
* mimeType: ?string,
|
||||
* annotations: ?Annotations,
|
||||
|
|
@ -157,6 +159,7 @@ final class ArrayLoader implements LoaderInterface
|
|||
$resource = new Resource(
|
||||
uri: $data['uri'],
|
||||
name: $name,
|
||||
title: $data['title'] ?? null,
|
||||
description: $description,
|
||||
mimeType: $data['mimeType'] ?? null,
|
||||
annotations: $data['annotations'] ?? null,
|
||||
|
|
@ -197,6 +200,7 @@ final class ArrayLoader implements LoaderInterface
|
|||
$template = new ResourceTemplate(
|
||||
uriTemplate: $data['uriTemplate'],
|
||||
name: $name,
|
||||
title: $data['title'] ?? null,
|
||||
description: $description,
|
||||
mimeType: $data['mimeType'] ?? null,
|
||||
annotations: $data['annotations'] ?? null,
|
||||
|
|
|
|||
Loading…
Reference in a new issue