From d4a959511a74126cd30d23265d6bc12cccab0c80 Mon Sep 17 00:00:00 2001 From: KACEM Oussama Date: Sat, 21 Nov 2026 21:46:20 +0100 Subject: [PATCH 1/2] [Server] Answer arguments the input schema refuses with a tool error from 2025-11-25 on SEP-1303, part of revision 2025-11-25, moved input validation errors from protocol errors to tool execution errors, so that the model reads what was wrong and can retry. Sessions up to 2025-06-18 keep -32602. Fixes #763 --- CHANGELOG.md | 1 + docs/protocol-versions.md | 3 + docs/servers/schemas.md | 31 ++++++- src/Schema/Enum/ProtocolVersion.php | 16 ++++ .../Handler/Request/CallToolHandler.php | 15 ++- .../Unit/Schema/Enum/ProtocolVersionTest.php | 14 +++ .../Handler/Request/CallToolHandlerTest.php | 91 +++++++++++++------ .../Server/Transport/StdioDualEraTest.php | 8 +- 8 files changed, 141 insertions(+), 38 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c977af64..f6ddf41e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to `mcp/sdk` will be documented in this file. ### Server * Fix const validation errors always reporting the expected value as null. +* [BC Break] Answer `tools/call` arguments that fail the tool's input schema with a tool result marked `isError` instead of `-32602`, from revision `2025-11-25` on (SEP-1303). The text is the message the error carried; sessions up to `2025-06-18` keep `-32602` with `validation_errors`. Adds `ProtocolVersion::reportsInvalidToolArgumentsAsToolError()`. 0.10.0 ------ diff --git a/docs/protocol-versions.md b/docs/protocol-versions.md index 5b29d147..115ec144 100644 --- a/docs/protocol-versions.md +++ b/docs/protocol-versions.md @@ -97,6 +97,9 @@ The same tool, resource and prompt registrations serve both eras. What changes: * **[Structured output](servers/tools.md#structured-output)**: from `2026-07-28`, a tool can send any JSON value as `structuredContent` ([SEP-2106](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2106)). Before it, only a JSON object. +* **[Argument validation](servers/schemas.md#argument-validation)**: from `2025-11-25`, arguments a tool's input + schema refuses come back as a tool result marked `isError` ([SEP-1303](https://github.com/modelcontextprotocol/modelcontextprotocol/issues/1303)). + Before it, as a `-32602` error. * **[Serving both eras](run/protocol-eras.md)** — what a modern request carries, how one endpoint classifies and routes each request, and how to serve one era only. * **[Caching](run/caching.md)** — the `ttlMs` / `cacheScope` hints a cacheable result must diff --git a/docs/servers/schemas.md b/docs/servers/schemas.md index b77f4934..f733cc53 100644 --- a/docs/servers/schemas.md +++ b/docs/servers/schemas.md @@ -171,7 +171,28 @@ public function getForecast( ## Argument Validation Before a `tools/call` reaches your method, the SDK validates the arguments against the tool's input schema. If they -don't match, your method is not called and the client gets a JSON-RPC error with code `-32602`: +don't match, your method is not called. What the client gets depends on the negotiated protocol revision. + +From `2025-11-25` on, the specification counts an input validation error as a tool execution error, so the answer is a +result with `isError: true`. The client hands it to the model, which can read what was wrong and call the tool again: + +```json +{ + "jsonrpc": "2.0", + "id": 3, + "result": { + "content": [ + { + "type": "text", + "text": "Invalid parameters for tool 'validateUser': Property '/age': Number must be greater than or equal to 18." + } + ], + "isError": true + } +} +``` + +Up to `2025-06-18`, invalid arguments are a protocol error, and the client gets a JSON-RPC error with code `-32602`: ```json { @@ -189,10 +210,10 @@ don't match, your method is not called and the client gets a JSON-RPC error with } ``` -By default, the validator stops at the first error. So the message and `validation_errors` hold one error. If you -configure the validator to report more errors, see -[Customizing the Generator and Validator](#customizing-the-generator-and-validator), the message lists the first three -and `validation_errors` contains all of them. +By default, the validator stops at the first error. So the message holds one error, and so does `validation_errors` +in the protocol error. If you configure the validator to report more errors, see +[Customizing the Generator and Validator](#customizing-the-generator-and-validator), the message lists the first three. +`validation_errors` contains all of them; the tool result has no such field, and the full list goes to the debug log. After this check, the SDK casts each argument to the type of its parameter. Prompts and resource templates have no input schema, so this is the only check for them. If a value can't be cast, your method is not called and the client gets a diff --git a/src/Schema/Enum/ProtocolVersion.php b/src/Schema/Enum/ProtocolVersion.php index 7812d9fe..37fb0c76 100644 --- a/src/Schema/Enum/ProtocolVersion.php +++ b/src/Schema/Enum/ProtocolVersion.php @@ -142,6 +142,22 @@ public function usesInvalidParamsForResourceNotFound(): bool return $this->isAtLeast(self::V2026_07_28); } + /** + * Whether this revision answers invalid tool arguments with a tool error. + * + * SEP-1303, part of {@see self::V2025_11_25}, moved input validation errors + * from protocol errors to tool execution errors, reported in the result + * with `isError: true`, so that the model reads what was wrong and can + * retry with adjusted arguments. Earlier revisions list "Invalid arguments" + * under protocol errors, answered with `-32602`. + * + * @see https://modelcontextprotocol.io/specification/2025-11-25/server/tools#error-handling + */ + public function reportsInvalidToolArgumentsAsToolError(): bool + { + return $this->isAtLeast(self::V2025_11_25); + } + /** * Whether this revision resumes an interrupted SSE stream with `Last-Event-ID`. * diff --git a/src/Server/Handler/Request/CallToolHandler.php b/src/Server/Handler/Request/CallToolHandler.php index e4d4ad5a..96cf63cd 100644 --- a/src/Server/Handler/Request/CallToolHandler.php +++ b/src/Server/Handler/Request/CallToolHandler.php @@ -82,11 +82,24 @@ public function handle(Request $request, SessionInterface $session): Response|Er return Error::forInvalidParams($e->getMessage(), $request->getId()); } + $context = new RequestContext($session, $request); + $inputSchema = $reference->tool->inputSchema; $validationErrors = $this->schemaValidator->validateAgainstJsonSchema((object) $arguments, $inputSchema); if (!empty($validationErrors)) { $summaryMessage = "Invalid parameters for tool '{$toolName}': ".self::summarizeValidationErrors($validationErrors); + $this->logger->debug('Tool arguments do not match the input schema', [ + 'name' => $toolName, + 'validation_errors' => $validationErrors, + ]); + + // SEP-1303: an input validation error is a tool execution error, + // which the model reads and can answer with adjusted arguments. + if ($context->getProtocolVersion()->reportsInvalidToolArgumentsAsToolError()) { + return new Response($request->getId(), CallToolResult::error([new TextContent($summaryMessage)])); + } + return Error::forInvalidParams($summaryMessage, $request->getId(), ['validation_errors' => $validationErrors]); } @@ -95,8 +108,6 @@ public function handle(Request $request, SessionInterface $session): Response|Er $arguments['_session'] = $session; $arguments['_request'] = $request; - $context = new RequestContext($session, $request); - try { $result = $this->referenceHandler->handle($reference, $arguments); diff --git a/tests/Unit/Schema/Enum/ProtocolVersionTest.php b/tests/Unit/Schema/Enum/ProtocolVersionTest.php index f1e6bbb0..80fad74a 100644 --- a/tests/Unit/Schema/Enum/ProtocolVersionTest.php +++ b/tests/Unit/Schema/Enum/ProtocolVersionTest.php @@ -155,6 +155,20 @@ public function testUsesInvalidParamsForResourceNotFound(): void $this->assertTrue(ProtocolVersion::V2026_07_28->usesInvalidParamsForResourceNotFound()); } + #[TestDox('2025-11-25 moves input validation errors from protocol errors to tool execution errors')] + public function testReportsInvalidToolArgumentsAsToolError(): void + { + foreach ([ProtocolVersion::V2024_11_05, ProtocolVersion::V2025_03_26, ProtocolVersion::V2025_06_18] as $version) { + $this->assertFalse( + $version->reportsInvalidToolArgumentsAsToolError(), + \sprintf('%s still lists invalid arguments under protocol errors.', $version->value), + ); + } + + $this->assertTrue(ProtocolVersion::V2025_11_25->reportsInvalidToolArgumentsAsToolError()); + $this->assertTrue(ProtocolVersion::V2026_07_28->reportsInvalidToolArgumentsAsToolError()); + } + #[TestDox('SEP-2575 removes SSE stream resumption')] public function testSupportsSseResumption(): void { diff --git a/tests/Unit/Server/Handler/Request/CallToolHandlerTest.php b/tests/Unit/Server/Handler/Request/CallToolHandlerTest.php index e19ac933..73846234 100644 --- a/tests/Unit/Server/Handler/Request/CallToolHandlerTest.php +++ b/tests/Unit/Server/Handler/Request/CallToolHandlerTest.php @@ -333,7 +333,7 @@ public function testToolNotFoundIsLoggedAsCalledButNotAsExecuted(): void { $this->registry->method('getTool')->willThrowException(new ToolNotFoundException('unknown')); - $this->assertCalledButNotExecuted($this->createCallToolRequest('unknown', [])); + $this->assertCalledButNotExecuted($this->createCallToolRequest('unknown', []), Error::class); } public function testInvalidArgumentsAreLoggedAsCalledButNotAsExecuted(): void @@ -341,7 +341,7 @@ public function testInvalidArgumentsAreLoggedAsCalledButNotAsExecuted(): void $toolReference = $this->createToolReference('strict', static fn () => 'unused'); $this->registry->method('getTool')->willReturn($toolReference); - $this->assertCalledButNotExecuted($this->createCallToolRequest('strict', ['example' => 123])); + $this->assertCalledButNotExecuted($this->createCallToolRequest('strict', ['example' => 123]), Response::class); } public function testHandleWithNullResult(): void @@ -805,41 +805,71 @@ public function testDeclaredOutputSchemaWithoutStructuredContentIsLogged(): void $this->assertNull($response->result->structuredContent); } - public function testValidationError(): void + /** + * @dataProvider provideRevisionsReportingRefusedArgumentsAsToolErrors + */ + public function testArgumentsRefusedByTheInputSchemaAreReportedAsAToolError(?string $negotiated): void { - $schema = [ - 'type' => 'object', - 'properties' => [ - 'favorite_number' => [ - 'type' => 'number', - 'description' => 'Your favorite number', - ], - ], - 'required' => [ - 'favorite_number', - ], - ]; + $request = $this->createCallToolRequest('strict', ['example' => 123]); + $toolReference = $this->createToolReference('strict', static fn () => 'unused'); - $request = $this->createCallToolRequest('result_tool', ['query' => 'php']); - $toolReference = $this->getMockBuilder(ToolReference::class) - ->setConstructorArgs([new Tool('simple_tool', null, $schema, null, null), static function () {}]) - ->getMock(); + $this->session->method('get')->with('protocol_version')->willReturn($negotiated); + $this->registry->method('getTool')->willReturn($toolReference); + $this->referenceHandler->expects($this->never())->method('handle'); - $this->registry - ->expects($this->once()) - ->method('getTool') - ->with('result_tool') - ->willReturn($toolReference); + $response = $this->handler->handle($request, $this->session); - $this->referenceHandler - ->expects($this->never()) - ->method('handle'); + $this->assertInstanceOf(Response::class, $response); + $this->assertEquals($request->getId(), $response->id); + $this->assertInstanceOf(CallToolResult::class, $response->result); + $this->assertTrue($response->result->isError); + $this->assertFalse($response->result->hasStructuredContent()); + $this->assertSame( + "Invalid parameters for tool 'strict': Property '/example': Invalid type. Expected `string`, but received `integer`.", + $this->firstText($response->result), + ); + } + + /** + * @return iterable + */ + public static function provideRevisionsReportingRefusedArgumentsAsToolErrors(): iterable + { + yield '2025-11-25' => ['2025-11-25']; + yield '2026-07-28' => ['2026-07-28']; + yield 'no revision negotiated' => [null]; + } + + /** + * @dataProvider provideRevisionsReportingRefusedArgumentsAsProtocolErrors + */ + public function testArgumentsRefusedByTheInputSchemaStayAProtocolErrorBeforeRevision20251125(string $negotiated): void + { + $request = $this->createCallToolRequest('strict', ['example' => 123]); + $toolReference = $this->createToolReference('strict', static fn () => 'unused'); + + $this->session->method('get')->with('protocol_version')->willReturn($negotiated); + $this->registry->method('getTool')->willReturn($toolReference); + $this->referenceHandler->expects($this->never())->method('handle'); $response = $this->handler->handle($request, $this->session); $this->assertInstanceOf(Error::class, $response); $this->assertEquals($request->getId(), $response->id); $this->assertEquals(Error::INVALID_PARAMS, $response->code); + $this->assertSame("Invalid parameters for tool 'strict': Property '/example': Invalid type. Expected `string`, but received `integer`.", $response->message); + $this->assertIsArray($response->data); + $this->assertArrayHasKey('validation_errors', $response->data); + } + + /** + * @return iterable + */ + public static function provideRevisionsReportingRefusedArgumentsAsProtocolErrors(): iterable + { + yield '2024-11-05' => ['2024-11-05']; + yield '2025-03-26' => ['2025-03-26']; + yield '2025-06-18' => ['2025-06-18']; } public function testStructuredContentMissingARequiredPropertyIsReportedAsAToolError(): void @@ -1087,7 +1117,10 @@ private function createCallToolRequest(string $name, array $arguments): CallTool ]); } - private function assertCalledButNotExecuted(CallToolRequest $request): void + /** + * @param class-string $answer + */ + private function assertCalledButNotExecuted(CallToolRequest $request, string $answer): void { $logger = new class extends AbstractLogger { public array $records = []; @@ -1102,7 +1135,7 @@ public function log($level, $message, array $context = []): void $this->referenceHandler->expects($this->never())->method('handle'); - $this->assertInstanceOf(Error::class, $handler->handle($request, $this->session)); + $this->assertInstanceOf($answer, $handler->handle($request, $this->session)); $messages = array_column($logger->records, 'message'); $this->assertContains('Calling tool', $messages); diff --git a/tests/Unit/Server/Transport/StdioDualEraTest.php b/tests/Unit/Server/Transport/StdioDualEraTest.php index 61907ca4..b18b700e 100644 --- a/tests/Unit/Server/Transport/StdioDualEraTest.php +++ b/tests/Unit/Server/Transport/StdioDualEraTest.php @@ -92,7 +92,9 @@ public function testToolArgumentsKeepTheirJsonType(string $type, string $json, b if ($accepted) { $this->assertSame(json_encode(json_decode($json)->value), $answer['result']['content'][0]['text']); } else { - $this->assertSame(Error::INVALID_PARAMS, $answer['error']['code']); + // Both openings speak a revision that reports refused arguments as a tool execution error. + $this->assertTrue($answer['result']['isError']); + $this->assertStringStartsWith("Invalid parameters for tool 'typed': ", $answer['result']['content'][0]['text']); } } } @@ -139,7 +141,9 @@ public function testSchemaKeywordsSeeTheJsonType(array $valueSchema, string $jso if ($accepted) { $this->assertSame(json_encode(json_decode($json)->value), $answer['result']['content'][0]['text']); } else { - $this->assertSame(Error::INVALID_PARAMS, $answer['error']['code']); + // Both openings speak a revision that reports refused arguments as a tool execution error. + $this->assertTrue($answer['result']['isError']); + $this->assertStringStartsWith("Invalid parameters for tool 'typed': ", $answer['result']['content'][0]['text']); } } } From 61107792d8ad1be77fb2a1d4d19af41925f7e984 Mon Sep 17 00:00:00 2001 From: KACEM Oussama Date: Mon, 30 Nov 2026 20:32:34 +0100 Subject: [PATCH 2/2] Put cast failures and missing arguments under the same predicate Review: a tool argument that cannot be cast, or that is missing, is an input validation error too. Prompts and resources keep -32602. --- CHANGELOG.md | 2 +- .../Handler/Request/CallToolHandler.php | 6 ++-- tests/Integration/IntArgumentTest.php | 8 ++--- .../Handler/Request/CallToolHandlerTest.php | 32 ++++++++++++++----- .../Server/Transport/StdioDualEraTest.php | 2 -- 5 files changed, 33 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6ddf41e..55a0040e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ All notable changes to `mcp/sdk` will be documented in this file. ### Server * Fix const validation errors always reporting the expected value as null. -* [BC Break] Answer `tools/call` arguments that fail the tool's input schema with a tool result marked `isError` instead of `-32602`, from revision `2025-11-25` on (SEP-1303). The text is the message the error carried; sessions up to `2025-06-18` keep `-32602` with `validation_errors`. Adds `ProtocolVersion::reportsInvalidToolArgumentsAsToolError()`. +* [BC Break] Answer invalid `tools/call` arguments with a tool result marked `isError` instead of `-32602`, from revision `2025-11-25` on (SEP-1303): arguments that fail the tool's input schema, that cannot be cast to their parameter type, or that are missing. The text is the message the error carried; sessions up to `2025-06-18` keep `-32602`, as do prompts and resources on every revision. Adds `ProtocolVersion::reportsInvalidToolArgumentsAsToolError()`. 0.10.0 ------ diff --git a/src/Server/Handler/Request/CallToolHandler.php b/src/Server/Handler/Request/CallToolHandler.php index 96cf63cd..139f2e21 100644 --- a/src/Server/Handler/Request/CallToolHandler.php +++ b/src/Server/Handler/Request/CallToolHandler.php @@ -94,8 +94,6 @@ public function handle(Request $request, SessionInterface $session): Response|Er 'validation_errors' => $validationErrors, ]); - // SEP-1303: an input validation error is a tool execution error, - // which the model reads and can answer with adjusted arguments. if ($context->getProtocolVersion()->reportsInvalidToolArgumentsAsToolError()) { return new Response($request->getId(), CallToolResult::error([new TextContent($summaryMessage)])); } @@ -176,6 +174,10 @@ public function handle(Request $request, SessionInterface $session): Response|Er if ($e instanceof RegistryException && $e->isInvalidParams()) { $this->logger->warning('Invalid arguments for tool', ['name' => $toolName, 'exception' => $e]); + if ($context->getProtocolVersion()->reportsInvalidToolArgumentsAsToolError()) { + return new Response($request->getId(), CallToolResult::error([new TextContent($e->getMessage())])); + } + return Error::forInvalidParams($e->getMessage(), $request->getId()); } diff --git a/tests/Integration/IntArgumentTest.php b/tests/Integration/IntArgumentTest.php index d38fa73b..2f6f7a9e 100644 --- a/tests/Integration/IntArgumentTest.php +++ b/tests/Integration/IntArgumentTest.php @@ -46,7 +46,7 @@ public function testToolCallOutOfRangeIsAnsweredWithInvalidParams(ProtocolVersio { $client = $this->connectOn($era); - $this->assertInvalidParams(static fn () => $client->callTool($tool, $arguments)); + $this->assertTrue($client->callTool($tool, $arguments)->isError); } #[DataProvider('provideEras')] @@ -54,9 +54,9 @@ public function testToolCallThatIsNotAnIntegerIsAnsweredWithInvalidParams(Protoc { $client = $this->connectOn($era); - $this->assertInvalidParams(static fn () => $client->callTool('permissive', ['qty' => 'abc'])); - $this->assertInvalidParams(static fn () => $client->callTool('permissive', ['qty' => 1.5])); - $this->assertInvalidParams(static fn () => $client->callTool('permissive', ['qty' => '99999999999999999999'])); + $this->assertTrue($client->callTool('permissive', ['qty' => 'abc'])->isError); + $this->assertTrue($client->callTool('permissive', ['qty' => 1.5])->isError); + $this->assertTrue($client->callTool('permissive', ['qty' => '99999999999999999999'])->isError); } #[DataProvider('provideEras')] diff --git a/tests/Unit/Server/Handler/Request/CallToolHandlerTest.php b/tests/Unit/Server/Handler/Request/CallToolHandlerTest.php index 73846234..96d590e4 100644 --- a/tests/Unit/Server/Handler/Request/CallToolHandlerTest.php +++ b/tests/Unit/Server/Handler/Request/CallToolHandlerTest.php @@ -26,6 +26,7 @@ use Mcp\Server\Exception\ToolNotFoundException; use Mcp\Server\Handler\Request\CallToolHandler; use Mcp\Server\Session\SessionInterface; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; use Psr\Log\AbstractLogger; @@ -458,9 +459,28 @@ public function testHandleGenericExceptionReturnsError(): void $this->assertEquals('Error while executing tool', $response->message); } - public function testHandleAnswersInvalidParamsFromReferenceHandlerWithInvalidParams(): void + #[DataProvider('provideRevisionsReportingRefusedArgumentsAsToolErrors')] + public function testArgumentsTheReferenceHandlerRefusesAreReportedAsAToolError(?string $negotiated): void { $request = $this->createCallToolRequest('order', ['qty' => 'abc']); + $this->session->method('get')->with('protocol_version')->willReturn($negotiated); + $this->registry->method('getTool')->willReturn($this->createToolReference('order', static fn () => null)); + $this->referenceHandler->method('handle')->willThrowException(RegistryException::invalidParams('Cannot cast value to integer.')); + + $response = $this->handler->handle($request, $this->session); + + $this->assertInstanceOf(Response::class, $response); + $this->assertEquals($request->getId(), $response->id); + $this->assertInstanceOf(CallToolResult::class, $response->result); + $this->assertTrue($response->result->isError); + $this->assertSame('Cannot cast value to integer.', $this->firstText($response->result)); + } + + #[DataProvider('provideRevisionsReportingRefusedArgumentsAsProtocolErrors')] + public function testHandleAnswersInvalidParamsFromReferenceHandlerWithInvalidParams(string $negotiated): void + { + $request = $this->createCallToolRequest('order', ['qty' => 'abc']); + $this->session->method('get')->with('protocol_version')->willReturn($negotiated); $this->registry->method('getTool')->willReturn($this->createToolReference('order', static fn () => null)); $this->referenceHandler->method('handle')->willThrowException(RegistryException::invalidParams('Cannot cast value to integer.')); @@ -805,9 +825,7 @@ public function testDeclaredOutputSchemaWithoutStructuredContentIsLogged(): void $this->assertNull($response->result->structuredContent); } - /** - * @dataProvider provideRevisionsReportingRefusedArgumentsAsToolErrors - */ + #[DataProvider('provideRevisionsReportingRefusedArgumentsAsToolErrors')] public function testArgumentsRefusedByTheInputSchemaAreReportedAsAToolError(?string $negotiated): void { $request = $this->createCallToolRequest('strict', ['example' => 123]); @@ -840,10 +858,8 @@ public static function provideRevisionsReportingRefusedArgumentsAsToolErrors(): yield 'no revision negotiated' => [null]; } - /** - * @dataProvider provideRevisionsReportingRefusedArgumentsAsProtocolErrors - */ - public function testArgumentsRefusedByTheInputSchemaStayAProtocolErrorBeforeRevision20251125(string $negotiated): void + #[DataProvider('provideRevisionsReportingRefusedArgumentsAsProtocolErrors')] + public function testValidationError(string $negotiated): void { $request = $this->createCallToolRequest('strict', ['example' => 123]); $toolReference = $this->createToolReference('strict', static fn () => 'unused'); diff --git a/tests/Unit/Server/Transport/StdioDualEraTest.php b/tests/Unit/Server/Transport/StdioDualEraTest.php index b18b700e..c55447a8 100644 --- a/tests/Unit/Server/Transport/StdioDualEraTest.php +++ b/tests/Unit/Server/Transport/StdioDualEraTest.php @@ -92,7 +92,6 @@ public function testToolArgumentsKeepTheirJsonType(string $type, string $json, b if ($accepted) { $this->assertSame(json_encode(json_decode($json)->value), $answer['result']['content'][0]['text']); } else { - // Both openings speak a revision that reports refused arguments as a tool execution error. $this->assertTrue($answer['result']['isError']); $this->assertStringStartsWith("Invalid parameters for tool 'typed': ", $answer['result']['content'][0]['text']); } @@ -141,7 +140,6 @@ public function testSchemaKeywordsSeeTheJsonType(array $valueSchema, string $jso if ($accepted) { $this->assertSame(json_encode(json_decode($json)->value), $answer['result']['content'][0]['text']); } else { - // Both openings speak a revision that reports refused arguments as a tool execution error. $this->assertTrue($answer['result']['isError']); $this->assertStringStartsWith("Invalid parameters for tool 'typed': ", $answer['result']['content'][0]['text']); }