Skip to content

Commit 59095ea

Browse files
committed
_meta to meta
1 parent ae47b54 commit 59095ea

16 files changed

+86
-86
lines changed

src/Capability/Attribute/McpPrompt.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ final class McpPrompt
2323
/**
2424
* @param ?string $name overrides the prompt name (defaults to method name)
2525
* @param ?string $description Optional description of the prompt. Defaults to method DocBlock summary.
26-
* @param ?array<string, mixed> $_meta Optional metadata
26+
* @param ?array<string, mixed> $meta Optional metadata
2727
*/
2828
public function __construct(
2929
public ?string $name = null,
3030
public ?string $description = null,
31-
public ?array $_meta = null,
31+
public ?array $meta = null,
3232
) {
3333
}
3434
}

src/Capability/Attribute/McpResource.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class McpResource
2929
* @param ?string $mimeType the MIME type, if known and constant for this resource
3030
* @param ?int $size the size in bytes, if known and constant
3131
* @param Annotations|null $annotations optional annotations describing the resource
32-
* @param ?array<string, mixed> $_meta Optional metadata
32+
* @param ?array<string, mixed> $meta Optional metadata
3333
*/
3434
public function __construct(
3535
public string $uri,
@@ -38,7 +38,7 @@ public function __construct(
3838
public ?string $mimeType = null,
3939
public ?int $size = null,
4040
public ?Annotations $annotations = null,
41-
public ?array $_meta = null,
41+
public ?array $meta = null,
4242
) {
4343
}
4444
}

src/Capability/Attribute/McpResourceTemplate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ final class McpResourceTemplate
2828
* @param ?string $description Optional description. Defaults to class DocBlock summary.
2929
* @param ?string $mimeType optional default MIME type for matching resources
3030
* @param ?Annotations $annotations optional annotations describing the resource template
31-
* @param ?array<string, mixed> $_meta Optional metadata
31+
* @param ?array<string, mixed> $meta Optional metadata
3232
*/
3333
public function __construct(
3434
public string $uriTemplate,
3535
public ?string $name = null,
3636
public ?string $description = null,
3737
public ?string $mimeType = null,
3838
public ?Annotations $annotations = null,
39-
public ?array $_meta = null,
39+
public ?array $meta = null,
4040
) {
4141
}
4242
}

src/Capability/Attribute/McpTool.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ class McpTool
2323
* @param string|null $name The name of the tool (defaults to the method name)
2424
* @param string|null $description The description of the tool (defaults to the DocBlock/inferred)
2525
* @param ToolAnnotations|null $annotations Optional annotations describing tool behavior
26-
* @param ?array<string, mixed> $_meta Optional metadata
26+
* @param ?array<string, mixed> $meta Optional metadata
2727
*/
2828
public function __construct(
2929
public ?string $name = null,
3030
public ?string $description = null,
3131
public ?ToolAnnotations $annotations = null,
32-
public ?array $_meta = null,
32+
public ?array $meta = null,
3333
) {
3434
}
3535
}

src/Capability/Discovery/Discoverer.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,8 @@ private function processMethod(\ReflectionMethod $method, array &$discoveredCoun
222222
$name = $instance->name ?? ('__invoke' === $methodName ? $classShortName : $methodName);
223223
$description = $instance->description ?? $this->docBlockParser->getSummary($docBlock) ?? null;
224224
$inputSchema = $this->schemaGenerator->generate($method);
225-
$_meta = $instance->_meta ?? null;
226-
$tool = new Tool($name, $inputSchema, $description, $instance->annotations, $_meta);
225+
$meta = $instance->meta ?? null;
226+
$tool = new Tool($name, $inputSchema, $description, $instance->annotations, $meta);
227227
$tools[$name] = new ToolReference($tool, [$className, $methodName], false);
228228
++$discoveredCount['tools'];
229229
break;
@@ -235,8 +235,8 @@ private function processMethod(\ReflectionMethod $method, array &$discoveredCoun
235235
$mimeType = $instance->mimeType;
236236
$size = $instance->size;
237237
$annotations = $instance->annotations;
238-
$_meta = $instance->_meta;
239-
$resource = new Resource($instance->uri, $name, $description, $mimeType, $annotations, $size, $_meta);
238+
$meta = $instance->meta;
239+
$resource = new Resource($instance->uri, $name, $description, $mimeType, $annotations, $size, $meta);
240240
$resources[$instance->uri] = new ResourceReference($resource, [$className, $methodName], false);
241241

242242
++$discoveredCount['resources'];
@@ -256,8 +256,8 @@ private function processMethod(\ReflectionMethod $method, array &$discoveredCoun
256256
$paramTag = $paramTags['$'.$param->getName()] ?? null;
257257
$arguments[] = new PromptArgument($param->getName(), $paramTag ? trim((string) $paramTag->getDescription()) : null, !$param->isOptional() && !$param->isDefaultValueAvailable());
258258
}
259-
$_meta = $instance->_meta ?? null;
260-
$prompt = new Prompt($name, $description, $arguments, $_meta);
259+
$meta = $instance->meta ?? null;
260+
$prompt = new Prompt($name, $description, $arguments, $meta);
261261
$completionProviders = $this->getCompletionProviders($method);
262262
$prompts[$name] = new PromptReference($prompt, [$className, $methodName], false, $completionProviders);
263263
++$discoveredCount['prompts'];
@@ -269,8 +269,8 @@ private function processMethod(\ReflectionMethod $method, array &$discoveredCoun
269269
$description = $instance->description ?? $this->docBlockParser->getSummary($docBlock) ?? null;
270270
$mimeType = $instance->mimeType;
271271
$annotations = $instance->annotations;
272-
$_meta = $instance->_meta ?? null;
273-
$resourceTemplate = new ResourceTemplate($instance->uriTemplate, $name, $description, $mimeType, $annotations, $_meta);
272+
$meta = $instance->meta ?? null;
273+
$resourceTemplate = new ResourceTemplate($instance->uriTemplate, $name, $description, $mimeType, $annotations, $meta);
274274
$completionProviders = $this->getCompletionProviders($method);
275275
$resourceTemplates[$instance->uriTemplate] = new ResourceTemplateReference($resourceTemplate, [$className, $methodName], false, $completionProviders);
276276
++$discoveredCount['resourceTemplates'];

src/Capability/Registry/Loader/ArrayLoader.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ final class ArrayLoader implements LoaderInterface
4545
* name: ?string,
4646
* description: ?string,
4747
* annotations: ?ToolAnnotations,
48-
* _meta: ?array<string, mixed>
48+
* meta: ?array<string, mixed>
4949
* }[] $tools
5050
* @param array{
5151
* handler: Handler,
@@ -55,7 +55,7 @@ final class ArrayLoader implements LoaderInterface
5555
* mimeType: ?string,
5656
* size: int|null,
5757
* annotations: ?Annotations,
58-
* _meta: ?array<string, mixed>
58+
* meta: ?array<string, mixed>
5959
* }[] $resources
6060
* @param array{
6161
* handler: Handler,
@@ -64,13 +64,13 @@ final class ArrayLoader implements LoaderInterface
6464
* description: ?string,
6565
* mimeType: ?string,
6666
* annotations: ?Annotations,
67-
* _meta: ?array<string, mixed>
67+
* meta: ?array<string, mixed>
6868
* }[] $resourceTemplates
6969
* @param array{
7070
* handler: Handler,
7171
* name: ?string,
7272
* description: ?string,
73-
* _meta: ?array<string, mixed>
73+
* meta: ?array<string, mixed>
7474
* }[] $prompts
7575
*/
7676
public function __construct(
@@ -106,7 +106,7 @@ public function load(ReferenceRegistryInterface $registry): void
106106

107107
$inputSchema = $data['inputSchema'] ?? $schemaGenerator->generate($reflection);
108108

109-
$tool = new Tool($name, $inputSchema, $description, $data['annotations'], $data['_meta'] ?? null);
109+
$tool = new Tool($name, $inputSchema, $description, $data['annotations'], $data['meta'] ?? null);
110110
$registry->registerTool($tool, $data['handler'], true);
111111

112112
$handlerDesc = $this->getHandlerDescription($data['handler']);
@@ -141,9 +141,9 @@ public function load(ReferenceRegistryInterface $registry): void
141141
$mimeType = $data['mimeType'];
142142
$size = $data['size'];
143143
$annotations = $data['annotations'];
144-
$_meta = $data['_meta'];
144+
$meta = $data['meta'];
145145

146-
$resource = new Resource($uri, $name, $description, $mimeType, $annotations, $size, $_meta);
146+
$resource = new Resource($uri, $name, $description, $mimeType, $annotations, $size, $meta);
147147
$registry->registerResource($resource, $data['handler'], true);
148148

149149
$handlerDesc = $this->getHandlerDescription($data['handler']);
@@ -177,9 +177,9 @@ public function load(ReferenceRegistryInterface $registry): void
177177
$uriTemplate = $data['uriTemplate'];
178178
$mimeType = $data['mimeType'];
179179
$annotations = $data['annotations'];
180-
$_meta = $data['_meta'];
180+
$meta = $data['meta'];
181181

182-
$template = new ResourceTemplate($uriTemplate, $name, $description, $mimeType, $annotations, $_meta);
182+
$template = new ResourceTemplate($uriTemplate, $name, $description, $mimeType, $annotations, $meta);
183183
$completionProviders = $this->getCompletionProviders($reflection);
184184
$registry->registerResourceTemplate($template, $data['handler'], $completionProviders, true);
185185

@@ -230,8 +230,8 @@ public function load(ReferenceRegistryInterface $registry): void
230230
!$param->isOptional() && !$param->isDefaultValueAvailable(),
231231
);
232232
}
233-
$_meta = $data['_meta'];
234-
$prompt = new Prompt($name, $description, $arguments, $_meta);
233+
$meta = $data['meta'];
234+
$prompt = new Prompt($name, $description, $arguments, $meta);
235235
$completionProviders = $this->getCompletionProviders($reflection);
236236
$registry->registerPrompt($prompt, $data['handler'], $completionProviders, true);
237237

src/Capability/Registry/ResourceReference.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,11 @@ public function formatResult(mixed $readResult, string $uri, ?string $mimeType =
6868
return [$readResult->resource];
6969
}
7070

71-
$_meta = $this->schema->_meta;
71+
$meta = $this->schema->meta;
7272

7373
if (\is_array($readResult)) {
7474
if (empty($readResult)) {
75-
return [new TextResourceContents($uri, 'application/json', '[]', $_meta)];
75+
return [new TextResourceContents($uri, 'application/json', '[]', $meta)];
7676
}
7777

7878
$allAreResourceContents = true;
@@ -120,15 +120,15 @@ public function formatResult(mixed $readResult, string $uri, ?string $mimeType =
120120
if (\is_string($readResult)) {
121121
$mimeType = $mimeType ?? $this->guessMimeTypeFromString($readResult);
122122

123-
return [new TextResourceContents($uri, $mimeType, $readResult, $_meta)];
123+
return [new TextResourceContents($uri, $mimeType, $readResult, $meta)];
124124
}
125125

126126
if (\is_resource($readResult) && 'stream' === get_resource_type($readResult)) {
127127
$result = BlobResourceContents::fromStream(
128128
$uri,
129129
$readResult,
130130
$mimeType ?? 'application/octet-stream',
131-
$_meta
131+
$meta
132132
);
133133

134134
@fclose($readResult);
@@ -139,21 +139,21 @@ public function formatResult(mixed $readResult, string $uri, ?string $mimeType =
139139
if (\is_array($readResult) && isset($readResult['blob']) && \is_string($readResult['blob'])) {
140140
$mimeType = $readResult['mimeType'] ?? $mimeType ?? 'application/octet-stream';
141141

142-
return [new BlobResourceContents($uri, $mimeType, $readResult['blob'], $_meta)];
142+
return [new BlobResourceContents($uri, $mimeType, $readResult['blob'], $meta)];
143143
}
144144

145145
if (\is_array($readResult) && isset($readResult['text']) && \is_string($readResult['text'])) {
146146
$mimeType = $readResult['mimeType'] ?? $mimeType ?? 'text/plain';
147147

148-
return [new TextResourceContents($uri, $mimeType, $readResult['text'], $_meta)];
148+
return [new TextResourceContents($uri, $mimeType, $readResult['text'], $meta)];
149149
}
150150

151151
if ($readResult instanceof \SplFileInfo && $readResult->isFile() && $readResult->isReadable()) {
152152
if ($mimeType && str_contains(strtolower($mimeType), 'text')) {
153-
return [new TextResourceContents($uri, $mimeType, file_get_contents($readResult->getPathname()), $_meta)];
153+
return [new TextResourceContents($uri, $mimeType, file_get_contents($readResult->getPathname()), $meta)];
154154
}
155155

156-
return [BlobResourceContents::fromSplFileInfo($uri, $readResult, $mimeType, $_meta)];
156+
return [BlobResourceContents::fromSplFileInfo($uri, $readResult, $mimeType, $meta)];
157157
}
158158

159159
if (\is_array($readResult)) {
@@ -162,7 +162,7 @@ public function formatResult(mixed $readResult, string $uri, ?string $mimeType =
162162
try {
163163
$jsonString = json_encode($readResult, \JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT);
164164

165-
return [new TextResourceContents($uri, $mimeType, $jsonString, $_meta)];
165+
return [new TextResourceContents($uri, $mimeType, $jsonString, $meta)];
166166
} catch (\JsonException $e) {
167167
throw new RuntimeException(\sprintf('Failed to encode array as JSON for URI "%s": %s', $uri, $e->getMessage()));
168168
}
@@ -172,7 +172,7 @@ public function formatResult(mixed $readResult, string $uri, ?string $mimeType =
172172
$jsonString = json_encode($readResult, \JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT);
173173
$mimeType = $mimeType ?? 'application/json';
174174

175-
return [new TextResourceContents($uri, $mimeType, $jsonString, $_meta)];
175+
return [new TextResourceContents($uri, $mimeType, $jsonString, $meta)];
176176
} catch (\JsonException $e) {
177177
throw new RuntimeException(\sprintf('Failed to encode array as JSON for URI "%s": %s', $uri, $e->getMessage()));
178178
}

src/Capability/Registry/ResourceTemplateReference.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ public function formatResult(mixed $readResult, string $uri, ?string $mimeType =
101101
return [$readResult->resource];
102102
}
103103

104-
$_meta = $this->resourceTemplate->_meta;
104+
$meta = $this->resourceTemplate->meta;
105105

106106
if (\is_array($readResult)) {
107107
if (empty($readResult)) {
108-
return [new TextResourceContents($uri, 'application/json', '[]', $_meta)];
108+
return [new TextResourceContents($uri, 'application/json', '[]', $meta)];
109109
}
110110

111111
$allAreResourceContents = true;
@@ -153,15 +153,15 @@ public function formatResult(mixed $readResult, string $uri, ?string $mimeType =
153153
if (\is_string($readResult)) {
154154
$mimeType = $mimeType ?? $this->guessMimeTypeFromString($readResult);
155155

156-
return [new TextResourceContents($uri, $mimeType, $readResult, $_meta)];
156+
return [new TextResourceContents($uri, $mimeType, $readResult, $meta)];
157157
}
158158

159159
if (\is_resource($readResult) && 'stream' === get_resource_type($readResult)) {
160160
$result = BlobResourceContents::fromStream(
161161
$uri,
162162
$readResult,
163163
$mimeType ?? 'application/octet-stream',
164-
$_meta
164+
$meta
165165
);
166166

167167
@fclose($readResult);
@@ -172,21 +172,21 @@ public function formatResult(mixed $readResult, string $uri, ?string $mimeType =
172172
if (\is_array($readResult) && isset($readResult['blob']) && \is_string($readResult['blob'])) {
173173
$mimeType = $readResult['mimeType'] ?? $mimeType ?? 'application/octet-stream';
174174

175-
return [new BlobResourceContents($uri, $mimeType, $readResult['blob'], $_meta)];
175+
return [new BlobResourceContents($uri, $mimeType, $readResult['blob'], $meta)];
176176
}
177177

178178
if (\is_array($readResult) && isset($readResult['text']) && \is_string($readResult['text'])) {
179179
$mimeType = $readResult['mimeType'] ?? $mimeType ?? 'text/plain';
180180

181-
return [new TextResourceContents($uri, $mimeType, $readResult['text'], $_meta)];
181+
return [new TextResourceContents($uri, $mimeType, $readResult['text'], $meta)];
182182
}
183183

184184
if ($readResult instanceof \SplFileInfo && $readResult->isFile() && $readResult->isReadable()) {
185185
if ($mimeType && str_contains(strtolower($mimeType), 'text')) {
186-
return [new TextResourceContents($uri, $mimeType, file_get_contents($readResult->getPathname()), $_meta)];
186+
return [new TextResourceContents($uri, $mimeType, file_get_contents($readResult->getPathname()), $meta)];
187187
}
188188

189-
return [BlobResourceContents::fromSplFileInfo($uri, $readResult, $mimeType, $_meta)];
189+
return [BlobResourceContents::fromSplFileInfo($uri, $readResult, $mimeType, $meta)];
190190
}
191191

192192
if (\is_array($readResult)) {
@@ -195,7 +195,7 @@ public function formatResult(mixed $readResult, string $uri, ?string $mimeType =
195195
try {
196196
$jsonString = json_encode($readResult, \JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT);
197197

198-
return [new TextResourceContents($uri, $mimeType, $jsonString, $_meta)];
198+
return [new TextResourceContents($uri, $mimeType, $jsonString, $meta)];
199199
} catch (\JsonException $e) {
200200
throw new RuntimeException("Failed to encode array as JSON for URI '{$uri}': {$e->getMessage()}");
201201
}
@@ -205,7 +205,7 @@ public function formatResult(mixed $readResult, string $uri, ?string $mimeType =
205205
$jsonString = json_encode($readResult, \JSON_THROW_ON_ERROR | \JSON_PRETTY_PRINT);
206206
$mimeType = $mimeType ?? 'application/json';
207207

208-
return [new TextResourceContents($uri, $mimeType, $jsonString, $_meta)];
208+
return [new TextResourceContents($uri, $mimeType, $jsonString, $meta)];
209209
} catch (\JsonException $e) {
210210
throw new RuntimeException("Failed to encode array as JSON for URI '{$uri}': {$e->getMessage()}");
211211
}

0 commit comments

Comments
 (0)