Skip to content

Commit 1cf26e9

Browse files
author
klapaudius
committed
#45 Rename "inputs" to "input" in TestMcpPromptCommand and related files for consistency
- Updated option names, descriptions, exception messages, and output text to use "input" instead of "inputs". - Adjusted relevant code, tests, and documentation for uniformity.
1 parent 794d2c5 commit 1cf26e9

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ klp_mcp_server:
110110

111111
The project includes a Docker setup that can be used for development. The Docker setup includes Nginx, PHP-FPM with Redis extension, and Redis server.
112112

113-
For detailed instructions on how to set up and use the Docker containers, please refer to the [Development Guidelines](docs/development_guidelines.md#docker-setup).
113+
For detailed instructions on how to set up and use the Docker containers, please refer to the [Development Guidelines](CONTRIBUTING.md#docker-setup).
114114

115115
## Strongly Recommended
116116
Enhance your application's security by implementing OAuth2 Authentication. You can use the [klapaudius/oauth-server-bundle](https://github.com/klapaudius/FOSOAuthServerBundle) or any other compatible OAuth2 solution.
@@ -157,7 +157,7 @@ php bin/console mcp:test-prompt --list
157157
php bin/console mcp:test-tool MyCustomTool --input='{"param1":"value"}'
158158
159159
# Test with specific arguments
160-
php bin/console mcp:test-prompt MyCustomPrompt --arguments='{"topic":"AI","tone":"professional"}'
160+
php bin/console mcp:test-prompt MyCustomPrompt --input='{"topic":"AI","tone":"professional"}'
161161
```
162162

163163
This helps you rapidly develop and debug tools by:

src/Command/TestMcpPromptCommand.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Symfony\Component\Console\Output\OutputInterface;
1515
use Symfony\Component\Console\Style\SymfonyStyle;
1616

17-
#[AsCommand(name: 'mcp:test-prompt', description: 'Test an MCP prompt with simulated arguments')]
17+
#[AsCommand(name: 'mcp:test-prompt', description: 'Test an MCP prompt with simulated input')]
1818
class TestMcpPromptCommand extends Command
1919
{
2020
private const NOT_SPECIFIED = 'Not specified';
@@ -99,9 +99,9 @@ protected function configure(): void
9999
->addArgument('prompt', InputArgument::OPTIONAL, 'The name of the prompt to test')
100100
->addOption('input', '-i', InputOption::VALUE_OPTIONAL, 'JSON input for the prompt')
101101
->addOption('list', '-l', InputOption::VALUE_NONE, 'List all available prompts')
102-
->setDescription('Test an MCP prompt with simulated inputs')
102+
->setDescription('Test an MCP prompt with simulated input')
103103
->setHelp(<<<'EOT'
104-
mcp:test-prompt {prompt? : The name of the prompt to test} {--inputs= : JSON input for the prompt} {--list : List all available prompts}
104+
mcp:test-prompt {prompt? : The name of the prompt to test} {--input= : JSON input for the prompt} {--list : List all available prompts}
105105
EOT
106106
);
107107
}
@@ -131,12 +131,12 @@ private function testPrompt(): int
131131
$arguments = $this->getArgumentsFromOption()
132132
?? $this->askForArguments($prompt->getArguments());
133133
if ($arguments === null) {
134-
throw new TestMcpPromptCommandException('Invalid inputs.');
134+
throw new TestMcpPromptCommandException('Invalid input.');
135135
}
136136

137137
// Execute the prompt
138138
$this->io->text([
139-
'Executing prompt with inputs:',
139+
'Executing prompt with input:',
140140
json_encode($arguments, JSON_PRETTY_PRINT),
141141
]);
142142

@@ -222,7 +222,7 @@ public function displaySchema(PromptInterface $prompt): void
222222
public function getArgumentsFromOption(): ?array
223223
{
224224
// If arguments are provided as an option, use that
225-
$argumentsOption = $this->input->getOption('inputs');
225+
$argumentsOption = $this->input->getOption('input');
226226
if ($argumentsOption) {
227227
try {
228228
$decodedArguments = json_decode($argumentsOption, true);
@@ -301,7 +301,7 @@ private function listAllPrompts(): int
301301
$this->io->text([
302302
'To test a specific prompt, run:',
303303
' php bin/console mcp:test-prompt [prompt_name]',
304-
" php bin/console mcp:test-prompt [prompt_name] --inputs='{\"name\":\"value\"}'",
304+
" php bin/console mcp:test-prompt [prompt_name] --input='{\"name\":\"value\"}'",
305305
]);
306306

307307
return Command::SUCCESS;

tests/Command/TestMcpPromptCommandTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public function test_get_arguments_from_option_valid_json_returns_array(): void
208208

209209
$this->inputMock
210210
->method('getOption')
211-
->with('inputs')
211+
->with('input')
212212
->willReturn($validJson);
213213

214214
$result = $this->command->getArgumentsFromOption();
@@ -229,7 +229,7 @@ public function test_get_arguments_from_option_invalid_json_displays_error(): vo
229229

230230
$this->inputMock
231231
->method('getOption')
232-
->with('inputs')
232+
->with('input')
233233
->willReturn($invalidJson);
234234

235235
$this->ioMock
@@ -249,7 +249,7 @@ public function test_get_arguments_from_option_empty_option_returns_null(): void
249249
{
250250
$this->inputMock
251251
->method('getOption')
252-
->with('inputs')
252+
->with('input')
253253
->willReturn(null);
254254

255255
$result = $this->command->getArgumentsFromOption();
@@ -411,7 +411,7 @@ public function test_list_all_prompts_displays_table(): void
411411
->with([
412412
'To test a specific prompt, run:',
413413
' php bin/console mcp:test-prompt [prompt_name]',
414-
' php bin/console mcp:test-prompt [prompt_name] --inputs=\'{"name":"value"}\'',
414+
' php bin/console mcp:test-prompt [prompt_name] --input=\'{"name":"value"}\'',
415415
]);
416416

417417
$result = $this->command->execute($this->inputMock, $this->outputMock);
@@ -734,9 +734,9 @@ public function test_test_prompt_execution_failure(): void
734734
// Second call from displaySchema (no arguments)
735735
return $text === 'This prompt accepts no arguments.';
736736
} elseif ($textCallCount === 3) {
737-
// Third call - executing prompt with inputs
737+
// Third call - executing prompt with input
738738
return is_array($text) &&
739-
$text[0] === 'Executing prompt with inputs:' &&
739+
$text[0] === 'Executing prompt with input:' &&
740740
$text[1] === '[]';
741741
} elseif ($textCallCount === 4) {
742742
// Fourth call from error stack trace
@@ -783,7 +783,7 @@ public function test_test_prompt_with_invalid_arguments_from_option(): void
783783
$this->inputMock->method('getArgument')->with('prompt')->willReturn('test-prompt');
784784
$this->inputMock->method('getOption')->willReturnMap([
785785
['list', false], // First call is for --list
786-
['inputs', 'invalid-json'], // Second call is for --inputs
786+
['input', 'invalid-json'], // Second call is for --input
787787
]);
788788

789789
$promptMock = $this->createMock(PromptInterface::class);

0 commit comments

Comments
 (0)