fix(code-execution): support bracket notation and multiple import styles - #6290
Merged
Conversation
rabi
force-pushed
the
hyphenated-toolnames
branch
3 times, most recently
from
December 31, 2025 13:18
2fd7d2c to
901b173
Compare
Use bracket notation for tool calls to support tool names that are not
valid JS identifiers (e.g. names with hyphens like 'search-flight'):
- server["tool"]({ ... }) syntax for all tools
- import * as server from "server" for imports
Also export a namespace object with the server's name. Models sometimes
use named imports (import { github }) when the module only exported
individual tool functions, causing 'could not find export' errors.
Adding the server name as a named export makes both styles work:
- import * as github from "github"; github["tool"]({})
- import { github } from "github"; github["tool"]({})
Signed-off-by: rabi <ramishra@redhat.com>
rabi
force-pushed
the
hyphenated-toolnames
branch
from
January 1, 2026 04:04
901b173 to
a58f285
Compare
jamadeo
approved these changes
Jan 5, 2026
jamadeo
left a comment
Member
There was a problem hiding this comment.
Makes sense to me -- @alexhancock any reason not to do this?
alexhancock
approved these changes
Jan 5, 2026
Collaborator
|
agree, makes sense. merging. thanks for the contribution! |
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
Use bracket notation for tool calls to support tool names that are not
valid JS identifiers (e.g. names with hyphens like 'search-flight'):
Also export a namespace object with the server's name. Models sometimes
use named imports (import { github }) when the module only exported
individual tool functions, causing 'could not find export' errors.
Adding the server name as a named export makes both styles work:
Type of Change
AI Assistance
Testing
Unit tested and tested with mcp using tool names with hyphen.