From d71eebdacc3cbe8f71974a07fa2548f848c46fb0 Mon Sep 17 00:00:00 2001 From: Valerio Date: Wed, 22 Apr 2026 12:25:39 +0200 Subject: [PATCH] fix(mcp): silence dead-code warning on tool_router field (closes #30) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cargo install webclaw-mcp on a fresh machine prints warning: field `tool_router` is never read --> crates/webclaw-mcp/src/server.rs:22:5 The field is essential — dropping it unregisters every MCP tool. The warning shows up because rmcp 1.3.x changed how the #[tool_handler] macro reads the field: instead of referencing it by name in the generated impl, it goes through a derived trait method. rustc's dead-code lint sees only the named usage and fires. The field stays. Annotated with #[allow(dead_code)] and a comment explaining the situation so the next person looking at this doesn't remove the field thinking it's actually unused. No behaviour change. Verified clean compile under rmcp 1.3.0 in our lock; the warning will disappear for anyone running cargo install against this commit. --- crates/webclaw-mcp/src/server.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/webclaw-mcp/src/server.rs b/crates/webclaw-mcp/src/server.rs index cdb79f0..f00eae7 100644 --- a/crates/webclaw-mcp/src/server.rs +++ b/crates/webclaw-mcp/src/server.rs @@ -19,6 +19,12 @@ use crate::cloud::{self, CloudClient, SmartFetchResult}; use crate::tools::*; pub struct WebclawMcp { + /// Holds the registered MCP tools. `rmcp >= 1.3` reads this through a + /// derived trait impl (not by name), so rustc's dead-code lint can't + /// see the usage and fires a spurious `field tool_router is never + /// read` on `cargo install`. The field is essential — dropping it + /// would unregister every tool. See issue #30. + #[allow(dead_code)] tool_router: ToolRouter, fetch_client: Arc, /// Lazily-initialized Firefox client, reused across all tool calls that