Fix Number Slider routing + id param name in get_component_info#6
Open
TWAWEI wants to merge 1 commit into
Open
Fix Number Slider routing + id param name in get_component_info#6TWAWEI wants to merge 1 commit into
TWAWEI wants to merge 1 commit into
Conversation
1. AddComponent switch: FuzzyMatcher normalizes 'slider' → 'Number Slider',
but the switch only had 'slider' / 'numberslider' / 'gh_numberslider' cases.
The normalized 'number slider' (with space) fell through to the default
branch, which then partial-name-matched to 'MD Slider' (alphabetical first).
Added 'number slider' case so the normalized output is matched directly.
2. get_component_info param name: bridge.py sent 'componentId' but the C#
handler reads GetParameter<string>("id"). Every call to get_component_info
was erroring 'Component ID is required'. Changed bridge.py to send 'id'
in all 3 call sites.
Verified via direct TCP:
slider → GH_NumberSlider (was MD Slider)
Number Slider → GH_NumberSlider
numberslider → GH_NumberSlider
7 tasks
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.
Summary
Two independent bug fixes I hit while testing the MCP on macOS. Both affect Windows too — the second one means
get_component_info(and everything that calls it, likeconnect_componentssmart-routing) has never worked.Bug 1 —
add_component('slider')creates MD Slider instead of Number SliderRepro: send
{\"type\":\"add_component\",\"parameters\":{\"type\":\"slider\",\"x\":0,\"y\":0}}to the .gha.Actual: returns
GH_MultiDimensionalSlider.Expected: returns
GH_NumberSlider.Root cause:
FuzzyMatcher.ComponentNameMapnormalizes\"slider\"→\"Number Slider\". TheswitchinComponentCommandHandler.AddComponenthascase \"slider\"/\"numberslider\"/\"gh_numberslider\"but not\"number slider\"(with space). So the normalized value falls through to the default branch, which does a partial name match using the original (non-normalized) input\"slider\"— the first proxy whose name contains\"slider\"wins, which happens to be\"MD Slider\".Fix: add
case \"number slider\":alongside the existing slider cases so the post-normalization value is matched directly.Bug 2 —
get_component_infoparameter name mismatchRepro: call the
get_component_infoMCP tool from any client.Actual:
\"Error executing command 'get_component_info': Component ID is required\".Root cause:
bridge.pysends the ID under keycomponentId, but the C# handler readscommand.GetParameter<string>(\"id\"). Every call has been failing with "Component ID is required". This also breaksconnect_components' auto-routing logic (for multi-input components like Addition), which internally callsget_component_info.Fix: change
bridge.pyto send\"id\"in all 3 call sites.Test plan
On Mac (Rhino 8.21 for Mac, net7.0 build of the .gha), verified via direct TCP:
\"slider\"\"Number Slider\"\"numberslider\"And
get_component_infonow returns the full component metadata (inputs, outputs, dataType, descriptions) instead of the "Component ID is required" error.Notes
Nothing Mac-specific in either fix — they both affect Windows identically. The upstream csproj already multi-targets
net7.0-windows;net7.0;net48, so the C# change rebuilds cleanly for all three without any platform conditionals.