rust-sdk/crates/rmcp/tests
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Brandon Bennett 9e3de344f4
feat: relax outputSchema to accept non-object JSON Schema types (SEP-2106) (#895)
* fix: address PR review - schema_for_output no longer validates or returns Result

- Add strip_output() that strips title/description without validating type (Dale #1)
- Change schema_for_output to return Arc<JsonObject> instead of Result (Dale #2)
- Cache only Arc<JsonObject> success values, not Result (Dale #3)
- Remove dead unwrap_or_else panic paths in with_output_schema, ToolBase, and macros
- Tighten test assertions from contains to assert_eq on type field (Dale #4)
- Update test_schema_for_output_rejects_primitive to accept_primitive (SEP-2106)

Co-authored-by: Orca <help@stably.ai>

* test(rmcp): add non-object output schema tests for SEP-2106

Add tests verifying schema_for_output accepts non-object types:
- test_tool_builder_methods: primitive (i32), array (Vec<String>), option
- test_structured_output: tool returning Json<Vec<T>> and Json<i32>
- test_json_schema_detection: Json<Vec<T>>, Result<Json<Vec<T>>,E>, Json<String>
- tool_traits: ToolBase::output_schema with Vec<AddOutput> output type

* test(rmcp): add missing edge case tests from code review

Add tests identified during code review:
- description stripping for primitive types
- composition types (Option<String> with anyOf/oneOf/null)
- cache correctness (Arc::ptr_eq for repeated calls)
- schema_for_input rejecting array types (not just primitives)
- schema_for_output accepting unit type ()

* feat!: mark schema_for_output return-type change as breaking

This introduces SEP-2106: schema_for_output no longer validates or
returns Result. The public signature changed, so bump major.

* fix: address Dale's PR review - direct schema.get assertions, remove ArrayTool

- Replace loose schema_str.contains(...) assertions with direct
  schema.get("type") equality checks in test_tool_builder_methods.rs
  and test_structured_output.rs
- Remove redundant ArrayTool fixture and its round-trip
  serde_json::from_str test from tool_traits.rs since schema is
  already Arc<JsonObject>
- Drop dead schema_str variable in test_structured_output.rs

---------

Co-authored-by: Brandon Bennett <brandonbennett@macbookair.myfiosgateway.com>
Co-authored-by: Orca <help@stably.ai>
Co-authored-by: Brandon Bennett <brandonbennett@Pursuits-Air.lan>
2026-07-08 14:19:28 -04:00
..
common feat: deprecate roots/sampling/logging types (#923) 2026-06-25 21:11:59 -04:00
test_deserialization fix(tasks): expose execution.taskSupport on tools (#635) 2026-02-03 19:17:36 -05:00
test_list_tools_result feat!: add MRTR model types (SEP-2322) (#915) 2026-07-08 14:03:33 -04:00
test_message_schema feat!: relax tool result structuredContent type (SEP-2106) (#933) 2026-07-08 14:14:07 -04:00
test_with_js refactor: provide http server as tower service (#228) 2025-05-28 19:21:40 +08:00
test_with_python feat: Add prompt support (#351) 2025-08-21 11:22:19 +08:00
test_cancelled_response.rs fix: don't respond to cancelled requests (#957) 2026-07-08 11:24:36 -04:00
test_client_credentials.rs fix(auth): align OAuth metadata discovery ordering (#887) 2026-06-22 11:34:18 -04:00
test_client_initialization.rs fix: reply -32700 on stdio parse errors instead of closing (#833) 2026-05-07 12:27:15 -04:00
test_close_connection.rs feat: add local feature for !Send tool handler support (#740) 2026-03-11 17:22:56 -04:00
test_completion.rs feat!: align model types with MCP 2025-11-25 spec (#927) 2026-06-24 20:41:13 -04:00
test_complex_schema.rs feat!: align model types with MCP 2025-11-25 spec (#927) 2026-06-24 20:41:13 -04:00
test_custom_headers.rs feat: standardize resource-not-found error code (SEP-2164) (#899) 2026-06-16 21:55:25 -04:00
test_custom_request.rs feat: add local feature for !Send tool handler support (#740) 2026-03-11 17:22:56 -04:00
test_deserialization.rs feat!: align model types with MCP 2025-11-25 spec (#927) 2026-06-24 20:41:13 -04:00
test_elicitation.rs feat!: add MRTR model types (SEP-2322) (#915) 2026-07-08 14:03:33 -04:00
test_embedded_resource_meta.rs feat!: align model types with MCP 2025-11-25 spec (#927) 2026-06-24 20:41:13 -04:00
test_handler_wrappers.rs chore: add #[non_exhaustive] and mutation methods to improve compatibility (#715) 2026-03-03 10:38:01 -05:00
test_inflight_response_drain.rs chore: consolidate repeated rmcp tests (#931) 2026-06-26 16:15:20 -04:00
test_json_schema_detection.rs feat: relax outputSchema to accept non-object JSON Schema types (SEP-2106) (#895) 2026-07-08 14:19:28 -04:00
test_list_tools_result.rs fix: strip and validate tool outputSchema and inputSchema (#860) 2026-06-02 12:01:33 -04:00
test_logging.rs feat!: align model types with MCP 2025-11-25 spec (#927) 2026-06-24 20:41:13 -04:00
test_message_protocol.rs feat: deprecate roots/sampling/logging types (#923) 2026-06-25 21:11:59 -04:00
test_message_schema.rs chore(deps): update schemars requirement from 0.8 to 1.0 (#258) 2025-07-11 11:15:45 +08:00
test_meta_helpers.rs feat: add SEP-2575 meta helpers (#942) 2026-07-01 14:40:30 -04:00
test_notification.rs chore: consolidate repeated rmcp tests (#931) 2026-06-26 16:15:20 -04:00
test_progress_subscriber.rs chore: consolidate repeated rmcp tests (#931) 2026-06-26 16:15:20 -04:00
test_prompt_handler.rs fix: fill missing fully qualified syntax in prompt_handler macros (#866) 2026-06-26 12:38:17 -04:00
test_prompt_macro_annotations.rs feat!: align model types with MCP 2025-11-25 spec (#927) 2026-06-24 20:41:13 -04:00
test_prompt_macros.rs chore: consolidate repeated rmcp tests (#931) 2026-06-26 16:15:20 -04:00
test_prompt_routers.rs chore: consolidate repeated rmcp tests (#931) 2026-06-26 16:15:20 -04:00
test_protocol_version_negotiation.rs fix: negotiate protocol version in handler (#930) 2026-06-29 13:29:06 -04:00
test_request_timeout_progress.rs feat!: align model types with MCP 2025-11-25 spec (#927) 2026-06-24 20:41:13 -04:00
test_resource_link.rs feat!: align model types with MCP 2025-11-25 spec (#927) 2026-06-24 20:41:13 -04:00
test_resource_link_integration.rs feat!: align model types with MCP 2025-11-25 spec (#927) 2026-06-24 20:41:13 -04:00
test_resource_not_found_version.rs feat: standardize resource-not-found error code (SEP-2164) (#899) 2026-06-16 21:55:25 -04:00
test_sampling.rs feat!: relax tool result structuredContent type (SEP-2106) (#933) 2026-07-08 14:14:07 -04:00
test_server_initialization.rs fix: update peer info on duplicate initialize (#862) 2026-06-10 15:42:09 -04:00
test_sse_concurrent_streams.rs feat!: align model types with MCP 2025-11-25 spec (#927) 2026-06-24 20:41:13 -04:00
test_stateless_protocol_version.rs fix: negotiate protocol version in handler (#930) 2026-06-29 13:29:06 -04:00
test_stdio_response_concurrency.rs fix(transport): make AsyncRwTransport::receive cancel-safe (#941) (#947) 2026-07-02 09:08:24 -04:00
test_streamable_http_4xx_error_body.rs fix(rmcp): surface JSON-RPC error bodies on HTTP 4xx responses (#748) 2026-03-17 09:27:45 -04:00
test_streamable_http_connection_reuse.rs fix(http): drain SSE stream for connection reuse (#790) 2026-04-13 16:33:30 -04:00
test_streamable_http_empty_2xx_notification.rs fix: accept 200 with empty body in response to notifications in addition to 202 (#849) 2026-05-14 14:52:11 -04:00
test_streamable_http_idle_timeout_log.rs Fix/issue 817 idle timeout log level (#824) 2026-05-04 20:14:06 -04:00
test_streamable_http_init_timeout.rs fix: add init_timeout for streamable-http sessions (#811) 2026-05-01 09:20:50 -04:00
test_streamable_http_json_response.rs chore: add #[non_exhaustive] to remaining public structs (#768) 2026-03-26 10:23:58 -04:00
test_streamable_http_priming.rs fix: include http_request_id in request-wise priming event IDs (#799) 2026-04-16 12:02:35 -04:00
test_streamable_http_protocol_version.rs fix: prevent streamable HTTP session leak (#934) 2026-06-26 21:09:16 -04:00
test_streamable_http_session_store.rs feat: optional session store (resumabillity support) (#775) 2026-04-21 17:06:18 -04:00
test_streamable_http_stale_session.rs fix: fail orphaned streamable HTTP responses on reinit (#914) 2026-07-07 20:06:46 -04:00
test_structured_output.rs feat: relax outputSchema to accept non-object JSON Schema types (SEP-2106) (#895) 2026-07-08 14:19:28 -04:00
test_task.rs fix: address 2025-11-25 conformance audit findings (#951) 2026-07-02 22:42:35 -04:00
test_task_support_validation.rs chore: consolidate repeated rmcp tests (#931) 2026-06-26 16:15:20 -04:00
test_tool_builder_methods.rs feat: relax outputSchema to accept non-object JSON Schema types (SEP-2106) (#895) 2026-07-08 14:19:28 -04:00
test_tool_disable_notification.rs chore: consolidate repeated rmcp tests (#931) 2026-06-26 16:15:20 -04:00
test_tool_handler.rs Move whole rmcp crate to offcial rust sdk (#44) 2025-03-27 17:33:41 -04:00
test_tool_macro_annotations.rs feat(macros): auto-generate get_info and default router (#785) 2026-04-08 15:06:26 -04:00
test_tool_macros.rs chore: consolidate repeated rmcp tests (#931) 2026-06-26 16:15:20 -04:00
test_tool_result_meta.rs feat!: add MRTR model types (SEP-2322) (#915) 2026-07-08 14:03:33 -04:00
test_tool_routers.rs chore: consolidate repeated rmcp tests (#931) 2026-06-26 16:15:20 -04:00
test_trace_context.rs feat: add SEP-414 trace context meta accessors (#910) 2026-07-01 16:51:05 -04:00
test_unix_socket_transport.rs feat(transport): add Unix domain socket client for streamable HTTP (#749) 2026-03-24 09:50:32 -04:00
test_with_js.rs chore: add #[non_exhaustive] to remaining public structs (#768) 2026-03-26 10:23:58 -04:00
test_with_python.rs feat: add local feature for !Send tool handler support (#740) 2026-03-11 17:22:56 -04:00