Skip to content

Commit 3a296f9

Browse files
author
klapaudius
committed
Refactor schema key 'arguments' to 'properties'.
Updated all schema definitions and relevant method calls to use 'properties' instead of 'arguments', aligning with standard naming conventions. Adjusted tests, service logic, and stubs to ensure consistency and functionality.
1 parent 66536ed commit 3a296f9

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

src/Services/ToolService/Examples/HelloWorldTool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function getInputSchema(): array
2020
{
2121
return [
2222
'type' => 'object',
23-
'arguments' => [
23+
'properties' => [
2424
'name' => [
2525
'type' => 'string',
2626
'description' => 'Developer Name',

src/Services/ToolService/ToolParamsValidator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@ public static function validate(array $toolSchema, array $arguments): void
5555

5656
$valid = true;
5757
foreach ($arguments as $argument => $value) {
58-
$test = isset($toolSchema['arguments'][$argument])
59-
&& self::validateType($toolSchema['arguments'][$argument]['type'], $value);
58+
$test = isset($toolSchema['properties'][$argument])
59+
&& self::validateType($toolSchema['properties'][$argument]['type'], $value);
6060
if (! $test) {
61-
self::$errors[] = isset($toolSchema['arguments'][$argument])
62-
? "Invalid argument type for: $argument. Expected: {$toolSchema['arguments'][$argument]['type']}, got: ".gettype($value)
61+
self::$errors[] = isset($toolSchema['properties'][$argument])
62+
? "Invalid argument type for: $argument. Expected: {$toolSchema['properties'][$argument]['type']}, got: ".gettype($value)
6363
: "Unknown argument: $argument";
6464
}
6565
$valid &= $test;

src/stubs/tool.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class {{ className }} implements ToolInterface
3535
{
3636
return [
3737
'type' => 'object',
38-
'arguments' => [
38+
'properties' => [
3939
'param1' => [
4040
'type' => 'string',
4141
'description' => 'First parameter description',

tests/Services/ToolService/ToolParamsValidatorTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class ToolParamsValidatorTest extends TestCase
1919
public function test_validate_with_valid_arguments(): void
2020
{
2121
$toolSchema = [
22-
'arguments' => [
22+
'properties' => [
2323
'arg1' => ['type' => 'string'],
2424
'arg2' => ['type' => 'integer'],
2525
],
@@ -47,7 +47,7 @@ public function test_validate_with_valid_arguments(): void
4747
public function test_validate_with_missing_required_argument(): void
4848
{
4949
$toolSchema = [
50-
'arguments' => [
50+
'properties' => [
5151
'arg1' => ['type' => 'string'],
5252
'arg2' => ['type' => 'integer'],
5353
],
@@ -75,7 +75,7 @@ public function test_validate_with_missing_required_argument(): void
7575
public function test_validate_with_empty_optional_argument(): void
7676
{
7777
$toolSchema = [
78-
'arguments' => [
78+
'properties' => [
7979
'arg1' => ['type' => 'string'],
8080
],
8181
'required' => [],
@@ -93,7 +93,7 @@ public function test_validate_with_empty_optional_argument(): void
9393
public function test_validate_with_invalid_argument_not_in_schema(): void
9494
{
9595
$toolSchema = [
96-
'arguments' => [
96+
'properties' => [
9797
'arg1' => ['type' => 'array'],
9898
],
9999
'required' => ['arg1'],
@@ -121,7 +121,7 @@ public function test_validate_with_invalid_argument_not_in_schema(): void
121121
public function test_validate_with_invalid_argument_type(): void
122122
{
123123
$toolSchema = [
124-
'arguments' => [
124+
'properties' => [
125125
'arg1' => ['type' => 'string'],
126126
'arg2' => ['type' => 'boolean'],
127127
],
@@ -150,7 +150,7 @@ public function test_validate_with_invalid_argument_type(): void
150150
public function test_validate_with_empty_required_argument(): void
151151
{
152152
$toolSchema = [
153-
'arguments' => [
153+
'properties' => [
154154
'arg1' => ['type' => 'string'],
155155
],
156156
'required' => ['arg1'],

0 commit comments

Comments
 (0)