fix: WASM compilation errors in wasm_typed_tool.rs #79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR fixes two compilation errors that prevent pmcp v1.7.0 from building for the
wasm32-unknown-unknowntarget, enabling browser-based MCP clients.Issues Fixed
1. Missing Clone Trait Bound
Error:
Fix: Added
+ Clonebound tonameparameters in three methods that callname.clone():tool_typed(line 200)tool_typed_with_schema(line 212)tool_typed_simple(line 226)2. Unresolved Import
error_codesError:
Fix: Added
#[cfg(not(target_arch = "wasm32"))]to:error_codesre-export (line 237)validationmodule (line 242)test_wasm_validationtest (line 394)These items depend on
error_codes, which is compiled with#[cfg(not(target_arch = "wasm32"))]insrc/server/mod.rs:70.Changes
File:
src/server/wasm_typed_tool.rsTesting
✅ Library builds successfully:
cargo check --lib --all-features # Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.59s✅ All library tests pass:
✅ No clippy warnings:
cargo clippy --lib --all-features -- -D warnings # Finished `dev` profile [unoptimized + debuginfo] target(s) in 4.59s✅ Formatting check passes:
cargo fmt --all -- --check # (no output = success)Use Case
This fix enables browser-based MCP management UIs that:
Impact
+ Clonebound to existingimpl Into<String>parameters (satisfied by all common types like&str,String)Related Issues
This addresses the WASM compilation regression introduced in v1.7.0. Users were forced to downgrade to v1.2.2 to build WASM clients.
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com