rust-sdk/crates/rmcp/tests
Repository files (latest commit first)
Filename Latest commit message Latest commit date
sktrpathi 11093bc830
feat: add type-safe elicitation schema support (#465) (#466)
* feat: add type-safe elicitation schema support (#465)

Implement type-safe schema definitions for MCP elicitation requests,
replacing generic `JsonObject` with strongly-typed primitive schemas
per the [MCP 2025-06-18 specification](https://spec.modelcontextprotocol.io/specification/2025-06-18/server/elicitation/).

Features:
- Type-safe schema hierarchy (`StringSchema`, `NumberSchema`, `IntegerSchema`, `BooleanSchema`)
- Builder pattern with fluent API and 20+ convenience methods
- Build-time validation ensuring required fields exist in properties
- Private fields enforcing invariants through validated constructors
- Comprehensive validation support (range, length, format, enums)
- Typed property methods for cleaner schema construction

Benefits:
- Compile-time type safety prevents invalid schema construction
- 60-70% reduction in boilerplate through convenience methods
- Enforces MCP specification requirement for primitive-only properties
- Better IDE autocomplete and type inference
- Runtime validation catches schema errors early

Breaking changes:
- `CreateElicitationRequestParam.requested_schema` changed from `JsonObject` to `ElicitationSchema`
- `ElicitationSchemaBuilder::build()` now returns `Result` instead of direct value

Fixes #465

* fix: fix RMCP compliance

* feat: add conversion methods to ElicitationSchema

Add from_json_schema() and from_type() methods to ElicitationSchema
for easier type-to-schema conversion. This addresses feedback about
improving ergonomics when working with generated schemas.

Also make all struct fields public for better flexibility.

* chore: change `StringFormat` to enum
2025-10-15 17:55:10 +08:00
..
common feat: Add prompt support (#351) 2025-08-21 11:22:19 +08:00
test_deserialization fix(test): fix tool deserialization error (#68) 2025-03-31 13:05:35 +08:00
test_message_schema feat: add type-safe elicitation schema support (#465) (#466) 2025-10-15 17:55:10 +08: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_completion.rs feat: implement context-aware completion (MCP 2025-06-18) (#396) 2025-09-08 14:44:49 +08:00
test_complex_schema.rs feat: Add prompt support (#351) 2025-08-21 11:22:19 +08:00
test_deserialization.rs fix(test): fix tool deserialization error (#68) 2025-03-31 13:05:35 +08:00
test_elicitation.rs feat: add type-safe elicitation schema support (#465) (#466) 2025-10-15 17:55:10 +08:00
test_embedded_resource_meta.rs Spec conformance: meta support and spec updates (#415) 2025-09-04 14:23:36 -04:00
test_json_schema_detection.rs feat: Add support for Tool.outputSchema and CallToolResult.structuredContent (#316) 2025-07-31 16:32:24 +08:00
test_logging.rs test(context): test context request handling and refactor for reusable client-server tests (#97) 2025-04-07 10:13:05 +08:00
test_message_protocol.rs feat: extensions to context (#102) 2025-04-08 10:01:17 +08: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_notification.rs feat: unified error type (#308) 2025-07-09 11:23:39 +08:00
test_progress_subscriber.rs feat: Add prompt support (#351) 2025-08-21 11:22:19 +08:00
test_prompt_handler.rs feat: Add prompt support (#351) 2025-08-21 11:22:19 +08:00
test_prompt_macro_annotations.rs feat: Add prompt support (#351) 2025-08-21 11:22:19 +08:00
test_prompt_macros.rs feat: Add prompt support (#351) 2025-08-21 11:22:19 +08:00
test_prompt_routers.rs feat: Add prompt support (#351) 2025-08-21 11:22:19 +08:00
test_resource_link.rs feat: add resource_link support to tools and prompts (#381) 2025-08-29 18:13:38 +08:00
test_resource_link_integration.rs feat: add resource_link support to tools and prompts (#381) 2025-08-29 18:13:38 +08:00
test_sampling.rs example: add simpling example and test (#289) 2025-06-30 18:18:23 +08:00
test_structured_output.rs feat: Add prompt support (#351) 2025-08-21 11:22:19 +08:00
test_tool_builder_methods.rs feat: Add support for Tool.outputSchema and CallToolResult.structuredContent (#316) 2025-07-31 16:32:24 +08: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 refactor: refactor tool macros and router implementation (#261) 2025-06-24 04:01:22 +08:00
test_tool_macros.rs fix: generate default schema for tools with no params (#446) 2025-09-26 18:16:08 +08:00
test_tool_result_meta.rs feat(rmcp): add optional _meta to CallToolResult, EmbeddedResource, and ResourceContents (#386) 2025-09-02 13:47:09 -04:00
test_tool_routers.rs feat: Add prompt support (#351) 2025-08-21 11:22:19 +08:00
test_with_js.rs refactor: refactor tool macros and router implementation (#261) 2025-06-24 04:01:22 +08:00
test_with_python.rs feat(transport): add builder & expose child stderr (#305) 2025-07-05 09:14:43 +08:00