Skip to content

Commit 09b3366

Browse files
author
klapaudius
committed
Refactor getInputSchema handling to ensure StructuredSchema type enforcement and deprecation warning for arrays.
1 parent 4571599 commit 09b3366

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Command/TestMcpToolCommand.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,15 @@ public function displaySchema(BaseToolInterface $tool): void
202202
]);
203203
$this->io->newLine();
204204
// Get input schema
205+
$schema = $tool->getInputSchema();
206+
if ($schema instanceof StructuredSchema) {
207+
$schema = $schema->asArray();
208+
} else {
209+
$this->io->warning('The getInputSchema() method should return an instance of StructuredSchema. Using array is deprecated and will be removed in a future version.');
210+
}
205211
$this->io->text(array_merge(
206212
['Input schema:'],
207-
$this->getSchemaDisplayMessages($tool->getInputSchema())
213+
$this->getSchemaDisplayMessages($schema)
208214
));
209215
}
210216

0 commit comments

Comments
 (0)