fix(#10): emit ToolCall events for meta-tool invocations#12
fix(#10): emit ToolCall events for meta-tool invocations#12doobidoo wants to merge 1 commit intoModernOps888:masterfrom
Conversation
Bug A from ModernOps888#10. `handle_meta_find_tools` and `handle_meta_list_categories` previously emitted no `EventType::ToolCall`, so gateway activity driven through meta-tool dispatch never landed in `/api/metrics` and the dashboard's Tool Statistics pane stayed permanently empty for clients whose MCP flow (e.g. Claude Code via the stdio bridge on macOS) favors `mcplex_find_tools` discovery. `handle_meta_call_tool` already goes through `dispatch_real_tool`, which records under the real upstream tool name — unchanged. Each affected handler now times itself from entry and emits a ToolCall event under `tool_name = "mcplex_find_tools"` or `"mcplex_list_categories"` with `server_name = "mcplex"`. The empty-query error branch in `find_tools` also records a `success: false` event so error rates are tracked. Verified: `cargo build --release` clean, `cargo fmt --check` clean. Fixes: ModernOps888#10
Live verificationBuilt PR branch locally and ran against a minimal config ( ``` === CALLS === === AFTER === Matches the expected behavior from the PR description:
The dashboard's Tool Statistics section now populates for any client that drives the gateway through meta-tool discovery (which is the dominant pattern on macOS via the stdio bridge). Closes #10. |
Closes #10.
Summary
handle_meta_find_toolsandhandle_meta_list_categoriespreviously emitted noEventType::ToolCall, so invocations through those dispatch paths never landed in/api/metrics. Clients whose MCP flow is biased towardmcplex_find_tools(e.g. Claude Desktop/Code via the stdio bridge on macOS) would see a permanently empty Tool Statistics dashboard pane.handle_meta_call_toolalready routes throughdispatch_real_tool, which records under the real upstream tool name — left alone.Changes
src/protocol/transport.rs:handle_meta_find_tools: start-time capture at function entry.EventType::ToolCallemitted on the success return path. Also emitted withsuccess: falseon the empty-query error branch so error rates don't silently hide.handle_meta_list_categories: same pattern for the success return (no user-input error branch here).tool_name = "<meta_tool_name>",server_name = "mcplex".Verified
cargo build --release— cleancargo fmt --all -- --check— cleanNo behavior change for
mcplex_call_tool, no schema change, no config change. Minimum-surface fix for the reported regression.