fix(sdk): instrument Skybridge's registerTool(config, cb)#15
Open
marselsel wants to merge 1 commit into
Open
Conversation
The proxy's `registerTool` interceptor only handled the MCP-SDK `registerTool(name, config, cb)` signature — name from a string `args[0]`, callback from `args[2]`. Skybridge's `McpServer` uses `registerTool(config, cb)` (name on `config.name`, callback at `args[1]`), so the interceptor wrapped nothing: Skybridge-registered tools emitted a `tool_discovery` named "unknown" and produced **no `tool_call` or `connection` events**. Locate the callback by type and derive the name from the string arg or the config object's `name`, so both signatures are instrumented. The MCP-SDK path is unchanged (same name, same wrapped callback); this only adds the Skybridge case. The fluent-chain handling already supported Skybridge — this completes it. Verified empirically against @yavio/sdk@0.1.6 + skybridge 0.36 and 1.1: a Skybridge `registerTool(config, cb)` now emits tool_discovery (correct name), connection, and tool_call. Adds regression tests for the 2-arg form. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Coverage Report for sdk
File Coverage
|
||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
createProxy'sregisterToolinterceptor only understands the MCP-SDK signatureregisterTool(name, config, cb)(name = stringargs[0], callback =args[2]). Skybridge'sMcpServerusesregisterTool(config, cb)— the name lives onconfig.nameand the callback isargs[1]. So against a Skybridge server the interceptor wraps nothing: tools emit atool_discoverynamed"unknown"and produce zerotool_call/connectionevents.This affects every Skybridge-based MCP app (any skybridge version — 1.1.0 still uses the same 2-arg
(config, cb)signature).Fix
Find the callback by type instead of a fixed index, and derive the tool name from the string arg or the config object's
name. ~15 lines inproxy.ts.tool_discovery(correct name),connection,tool_callall fire.chainable) already supported Skybridge'sreturn this; this completes it.Verification
proxy.test.ts→ "Skybridge registerTool(config, cb)") covering name derivation, handler wrapping →tool_call, and fluent chaining.@yavio/sdk@0.1.6with skybridge 0.36 and 1.1: a SkybridgeregisterTool(config, cb)emitstool_discovery(correct name),connection, andtool_call.🤖 Generated with Claude Code