Skip to content

Remove dead tool_router field (rmcp 1.8 macro change) - #20

Merged
getappz merged 1 commit into
masterfrom
fix-dead-tool-router-field
Jul 6, 2026
Merged

Remove dead tool_router field (rmcp 1.8 macro change)#20
getappz merged 1 commit into
masterfrom
fix-dead-tool-router-field

Conversation

@getappz

@getappz getappz commented Jul 6, 2026

Copy link
Copy Markdown
Owner

Summary

The rmcp 0.16 -> 1.8.0 upgrade made the tool_router: ToolRouter<Self> field
on AgentflareMcp dead code, producing:

warning: field `tool_router` is never read
  --> src/mcp_server.rs:36

Root cause

In rmcp 0.16, #[tool_handler]'s generated list_tools/call_tool methods
read the struct's tool_router field directly. In rmcp 1.8.0 the generated
code instead calls the associated function Self::tool_router() (produced by
#[tool_router]), never touching the field. Verified against the real macro
source at rmcp-macros-1.8.0/src/tool_handler.rs:22.

Fix

Since AgentflareMcp had no other fields, it's now a unit struct:

#[derive(Clone)]
pub struct AgentflareMcp;

new() was removed (nothing left to initialize) and the ~9 call sites
(AgentflareMcp::new() in run() and tests) were updated to construct the
unit struct directly (AgentflareMcp). The now-unused ToolRouter import was
dropped too.

Test plan

  • cargo build — the tool_router warning is gone; only the
    pre-existing optimize::RouteContext dead-field warning remains.
  • cargo test -- --test-threads=1 — 94/94 pass.
  • E2E stdio dispatch through the macro-generated router (tools/list
    returns both check_session_health and get_routing_suggestion;
    tools/call get_routing_suggestion returns a cheap-model suggestion).

@getappz
getappz merged commit 2bce4b3 into master Jul 6, 2026
7 checks passed
@getappz
getappz deleted the fix-dead-tool-router-field branch July 6, 2026 12:10
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant