Skip to content

Commit 7a5fe1f

Browse files
committed
chore: release v1.6.0 - production-ready type-safe tools
BREAKING: None NEW FEATURES: - Type-safe schema generation with production enhancements - Configurable schema normalization (depth/size limits) - Consistent validation error codes for client elicitation - Cross-platform path validation with security constraints - Optional output typing with TypedToolV2<TIn, TOut> - Full cross-transport support (HTTP, SSE, WebSocket) - WASM-compatible typed tool API for browser/edge - Ergonomic builder methods: tool_typed() and tool_typed_sync() - Comprehensive validation helpers with elicitation support EXAMPLES: - 32_typed_tools: Basic typed tool usage - 33_advanced_typed_tools: Complex validation scenarios - 34_serverbuilder_typed: Builder method demonstration - 35_wasm_typed_tools: WASM compatibility example DOCUMENTATION: - Move Quick Start section to top of README - Update all version references to 1.6.0 - Add comprehensive v1.6.0 release notes - Document all new examples in examples list
1 parent c21c837 commit 7a5fe1f

File tree

2 files changed

+95
-59
lines changed

2 files changed

+95
-59
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "pmcp"
3-
version = "1.5.5"
3+
version = "1.6.0"
44
edition = "2021"
55
authors = ["PAIML Team"]
66
description = "High-quality Rust SDK for Model Context Protocol (MCP) with full TypeScript SDK compatibility"

README.md

Lines changed: 94 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,87 @@ Code Name: *Angel Rust*
2424

2525
> **🎉 Claude Code Compatible!** Version 1.4.0+ includes full JSON-RPC 2.0 compatibility, enabling seamless integration with Claude Code and all standard MCP clients. If you're experiencing connection issues, please [upgrade to v1.4.1+](MIGRATION_GUIDE.md).
2626
27+
## Quick Start
28+
29+
### Installation
30+
31+
Add to your `Cargo.toml`:
32+
33+
```toml
34+
[dependencies]
35+
pmcp = "1.6"
36+
```
37+
38+
### Type-Safe Tools with Automatic Schema Generation (v1.6.0+)
39+
40+
Create tools with compile-time type safety and automatic JSON schema generation:
41+
42+
```rust
43+
use pmcp::{ServerBuilder, TypedTool, TypedSyncTool, SimpleToolExt};
44+
use schemars::JsonSchema;
45+
use serde::{Deserialize, Serialize};
46+
47+
// Define your argument type with JsonSchema derive
48+
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
49+
struct CalculatorArgs {
50+
operation: String,
51+
a: f64,
52+
b: f64,
53+
}
54+
55+
// Create a server with typed tools
56+
let server = ServerBuilder::new()
57+
.name("calculator-server")
58+
.version("1.0.0")
59+
// Use the new tool_typed builder method
60+
.tool_typed("calculator", |args: CalculatorArgs, _extra| {
61+
Box::pin(async move {
62+
let result = match args.operation.as_str() {
63+
"add" => args.a + args.b,
64+
"subtract" => args.a - args.b,
65+
"multiply" => args.a * args.b,
66+
"divide" => args.a / args.b,
67+
_ => return Err(pmcp::Error::Validation("Unknown operation".into())),
68+
};
69+
Ok(serde_json::json!({ "result": result }))
70+
})
71+
})
72+
.build()?;
73+
```
74+
75+
The schema is automatically generated and included in the `tools/list` response, enabling:
76+
- **Type Safety**: Arguments are validated at compile time
77+
- **Auto-completion**: Clients can provide better UI based on schema
78+
- **Documentation**: Schema includes descriptions from doc comments
79+
- **Validation**: Runtime validation against the generated schema
80+
81+
## 🎉 Version 1.6.0 - Production-Ready Type-Safe Tools & Cross-Transport Support!
82+
83+
### 🚀 **Type-Safe Schema Generation Enhancement**
84+
- **Production-Ready Improvements**:
85+
- 📏 **Schema Normalization**: Configurable depth/size limits prevent huge expanded schemas
86+
- 🎯 **Consistent Error Codes**: Standardized validation error codes for client elicitation
87+
- 🔒 **Cross-Platform Path Validation**: Robust Windows/Unix path handling with security constraints
88+
- 📝 **Output Typing**: Optional `TypedToolV2<TIn, TOut>` for better testing and documentation
89+
90+
- **Cross-Transport Support** ("Write Once, Run Anywhere"):
91+
-**Transport Compatibility**: Typed tools work seamlessly across HTTP, SSE, and WebSocket
92+
- 🌐 **WASM Support**: Browser and Cloudflare Workers compatible typed tool API
93+
- 🧪 **Comprehensive Testing**: E2E transport tests ensure compatibility
94+
- 🏗️ **Ergonomic Builder**: New `tool_typed()` and `tool_typed_sync()` builder methods
95+
96+
- **Validation Helpers**:
97+
- 📧 Email, URL, and regex pattern validation
98+
- 🔢 Range, length, and array size validation
99+
- 🛡️ Path traversal protection
100+
- 🤖 Elicitation-friendly error responses
101+
102+
### 📚 **New Examples**:
103+
- `32_typed_tools` - Basic typed tool usage with automatic schemas
104+
- `33_advanced_typed_tools` - Complex validation and nested structures
105+
- `34_serverbuilder_typed` - Using the ergonomic builder methods
106+
- `35_wasm_typed_tools` - WASM-compatible typed tools for browser/edge
107+
27108
## 🎉 Version 1.5.5 - Type-Safe Schema Generation & Critical Fixes!
28109

29110
### 🛡️ **Type-Safe Tool Creation with Automatic Schema Generation**
@@ -139,17 +220,6 @@ Code Name: *Angel Rust*
139220
- 📊 **Comprehensive Testing**: Property tests, fuzzing, and integration tests
140221
- 🏗️ **Quality First**: Zero technical debt, no unwraps in production code
141222

142-
## Quick Start
143-
144-
### Installation
145-
146-
Add to your `Cargo.toml`:
147-
148-
```toml
149-
[dependencies]
150-
pmcp = "1.4"
151-
```
152-
153223
> **⚠️ Important for Claude Code users**: Version 1.4.0+ is required for Claude Code compatibility. Earlier versions use a different message format that is incompatible with standard MCP clients. See the [Migration Guide](MIGRATION_GUIDE.md) if upgrading from < 1.4.0.
154224
155225
## 🌐 WebAssembly Support
@@ -299,8 +369,19 @@ cargo run --example 29_advanced_error_recovery --features full
299369
# Complete advanced error recovery example with cascade detection
300370
cargo run --example 31_advanced_error_recovery --features full
301371

302-
# SIMD parsing performance demonstration with benchmarks
303-
cargo run --example 32_simd_parsing_performance --features full
372+
# NEW in v1.6.0 - Type-Safe Tools with Schema Generation
373+
374+
# Type-safe tools with automatic JSON schema generation
375+
cargo run --example 32_typed_tools --features schema-generation
376+
377+
# Advanced typed tools with complex validation and nested structures
378+
cargo run --example 33_advanced_typed_tools --features schema-generation
379+
380+
# ServerBuilder typed tool methods demonstration
381+
cargo run --example 34_serverbuilder_typed --features schema-generation
382+
383+
# WASM-compatible typed tools for browser and edge environments
384+
cargo run --example 35_wasm_typed_tools --target wasm32-wasi --features schema-generation
304385

305386
# NEW in v1.4.1 - Enhanced Examples with TypeScript SDK Parity
306387

@@ -524,51 +605,6 @@ let batcher = MessageBatcher::new(BatchingConfig {
524605
});
525606
```
526607

527-
## Quick Start
528-
529-
### Type-Safe Tools with Automatic Schema Generation (v1.5.5+)
530-
531-
Create tools with compile-time type safety and automatic JSON schema generation:
532-
533-
```rust
534-
use pmcp::{TypedTool, TypedSyncTool, SimpleToolExt};
535-
use schemars::JsonSchema;
536-
use serde::{Deserialize, Serialize};
537-
538-
// Define your argument type with JsonSchema derive
539-
#[derive(Debug, Deserialize, Serialize, JsonSchema)]
540-
struct CalculatorArgs {
541-
operation: String,
542-
a: f64,
543-
b: f64,
544-
}
545-
546-
// Create a typed tool with automatic schema generation
547-
let tool = TypedTool::new("calculator", |args: CalculatorArgs, _extra| {
548-
Box::pin(async move {
549-
let result = match args.operation.as_str() {
550-
"add" => args.a + args.b,
551-
"subtract" => args.a - args.b,
552-
"multiply" => args.a * args.b,
553-
"divide" => args.a / args.b,
554-
_ => return Err(pmcp::Error::Validation("Unknown operation".into())),
555-
};
556-
Ok(serde_json::json!({ "result": result }))
557-
})
558-
})
559-
.with_description("Perform arithmetic operations");
560-
561-
// Or add schema to existing SimpleTool
562-
let simple_tool = SimpleTool::new("calculator", handler)
563-
.with_schema_from::<CalculatorArgs>();
564-
```
565-
566-
The schema is automatically generated and included in the `tools/list` response, enabling:
567-
- **Type Safety**: Arguments are validated at compile time
568-
- **Auto-completion**: Clients can provide better UI based on schema
569-
- **Documentation**: Schema includes descriptions from doc comments
570-
- **Validation**: Runtime validation against the generated schema
571-
572608
### Client Example
573609

574610
```rust

0 commit comments

Comments
 (0)