Skip to content

Commit e4b21d5

Browse files
committed
Revert "Add outputSchema to tool schemas"
This reverts commit 69ff8d5.
1 parent 69ff8d5 commit e4b21d5

File tree

9 files changed

+1
-81
lines changed

9 files changed

+1
-81
lines changed

src/Services/ToolService/BaseToolInterface.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,24 +46,6 @@ public function getDescription(): string;
4646
*/
4747
public function getInputSchema(): array;
4848

49-
/**
50-
* Gets the JSON Schema definition for the tool's output parameters.
51-
*
52-
* The schema defines the expected structure, types, and constraints for the
53-
* expected output structure. This schema is used
54-
* to provide type hints to LLM clients.
55-
*
56-
* @return array The JSON Schema as an associative array. Common structure:
57-
* [
58-
* 'type' => 'object',
59-
* 'properties' => [
60-
* 'param' => ['type' => 'string', 'description' => '...'],
61-
* ],
62-
* 'required' => ['param'],
63-
* ]
64-
*/
65-
public function getOutputSchema(): array;
66-
6749
/**
6850
* Gets the behavioral annotations for the tool.
6951
*

src/Services/ToolService/Examples/CodeAnalyzerTool.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ public function getInputSchema(): array
5151
];
5252
}
5353

54-
public function getOutputSchema(): array
55-
{
56-
return [];
57-
}
58-
5954
public function execute(array $arguments): ToolResultInterface
6055
{
6156
$code = $arguments['code'];

src/Services/ToolService/Examples/HelloWorldTool.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ public function getInputSchema(): array
3434
];
3535
}
3636

37-
public function getOutputSchema(): array
38-
{
39-
return [];
40-
}
41-
4237
public function getAnnotations(): ToolAnnotation
4338
{
4439
return new ToolAnnotation;

src/Services/ToolService/Examples/ProfileGeneratorTool.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@ public function getInputSchema(): array
5959
];
6060
}
6161

62-
public function getOutputSchema(): array
63-
{
64-
return [];
65-
}
66-
6762
public function getAnnotations(): ToolAnnotation
6863
{
6964
return new ToolAnnotation;

src/Services/ToolService/Examples/StreamingDataTool.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ public function getInputSchema(): array
5252
];
5353
}
5454

55-
public function getOutputSchema(): array
56-
{
57-
return [];
58-
}
59-
6055
public function getAnnotations(): ToolAnnotation
6156
{
6257
return new ToolAnnotation(

src/Services/ToolService/Examples/VersionCheckTool.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ public function getInputSchema(): array
3131
];
3232
}
3333

34-
public function getOutputSchema(): array
35-
{
36-
return [];
37-
}
38-
3934
public function getAnnotations(): ToolAnnotation
4035
{
4136
return new ToolAnnotation;

src/Services/ToolService/ToolRepository.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function getTool(string $name): ?StreamableToolInterface
109109
* Generates an array of schemas for all registered tools, suitable for the MCP capabilities response.
110110
* Includes name, description, inputSchema, and optional annotations for each tool.
111111
*
112-
* @return array<int, array{name: string, description: string, inputSchema: array<string, mixed>, outputSchema: array<string, mixed>, annotations?: array<string, mixed>}> An array of tool schemas.
112+
* @return array<int, array{name: string, description: string, inputSchema: array<string, mixed>, annotations?: array<string, mixed>}> An array of tool schemas.
113113
*/
114114
public function getToolSchemas(): array
115115
{
@@ -129,7 +129,6 @@ public function getToolSchemas(): array
129129
'name' => $tool->getName(),
130130
'description' => $tool->getDescription(),
131131
'inputSchema' => $tool->getInputSchema(),
132-
'outputSchema' => $tool->getOutputSchema(),
133132
'annotations' => $tool->getAnnotations()->toArray(),
134133
...$injectArray,
135134
];

tests/Server/Request/ToolsCallHandlerTest.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -515,11 +515,6 @@ public function getInputSchema(): array
515515
return ['type' => 'object', 'properties' => new \stdClass, 'required' => []];
516516
}
517517

518-
public function getOutputSchema(): array
519-
{
520-
return [];
521-
}
522-
523518
public function getAnnotations(): ToolAnnotation
524519
{
525520
return new ToolAnnotation;
@@ -791,11 +786,6 @@ public function getInputSchema(): array
791786
return ['type' => 'object', 'properties' => new \stdClass, 'required' => []];
792787
}
793788

794-
public function getOutputSchema(): array
795-
{
796-
return [];
797-
}
798-
799789
public function getAnnotations(): ToolAnnotation
800790
{
801791
return new ToolAnnotation;

tests/Services/ToolService/ToolRepositoryTest.php

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -254,30 +254,4 @@ public function test_get_tool_schemas_includes_annotations_if_present(): void
254254
'openWorldHint' => true,
255255
], $schemas[0]['annotations']);
256256
}
257-
258-
/**
259-
* Tests that getToolSchemas() includes outputSchema if it is present in a tool.
260-
*
261-
* Verifies that the method appends the outputSchema to the tool schema, ensuring
262-
* that metadata is preserved and available for the MCP capabilities response.
263-
*/
264-
public function test_get_tool_schemas_includes_output_schema_if_present(): void
265-
{
266-
$tool = $this->createMock(StreamableToolInterface::class);
267-
268-
$tool->method('getName')->willReturn('toolWithOutputSchema');
269-
$tool->method('getDescription')->willReturn('Tool with outputSchema');
270-
$tool->method('getInputSchema')->willReturn(['type' => 'object']);
271-
$tool->method('getOutputSchema')->willReturn(['type' => 'object']);
272-
273-
$this->toolRepository->register($tool);
274-
275-
$schemas = $this->toolRepository->getToolSchemas();
276-
277-
$this->assertCount(1, $schemas);
278-
$this->assertSame('toolWithOutputSchema', $schemas[0]['name']);
279-
$this->assertSame('Tool with outputSchema', $schemas[0]['description']);
280-
$this->assertSame(['type' => 'object'], $schemas[0]['inputSchema']);
281-
$this->assertSame(['type' => 'object'], $schemas[0]['outputSchema']);
282-
}
283257
}

0 commit comments

Comments
 (0)