Repository navigation
Conversation
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
@mcp-use/agent
@mcp-use/cli
@mcp-use/client
create-mcp-use-app
@mcp-use/inspector
mcp-use
@mcp-use/tunnel
commit: |
0973bd3 to
3d27904
Compare
There was a problem hiding this comment.
1 issue found and verified against the latest diff
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="libraries/typescript/.changeset/code-mode-e2b-search-tools-parity.md">
<violation number="1" location="libraries/typescript/.changeset/code-mode-e2b-search-tools-parity.md:2">
P1: `search_tools()` changes from an array to `{ meta, results }`, so existing E2B snippets using `.map`, `for...of`, or array destructuring now fail. This is a breaking `@mcp-use/client` contract; use a major bump or preserve array compatibility instead of publishing it as minor.</violation>
</file>
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
| @@ -0,0 +1,5 @@ | |||
| --- | |||
| "@mcp-use/client": minor | |||
There was a problem hiding this comment.
P1: search_tools() changes from an array to { meta, results }, so existing E2B snippets using .map, for...of, or array destructuring now fail. This is a breaking @mcp-use/client contract; use a major bump or preserve array compatibility instead of publishing it as minor.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. At libraries/typescript/.changeset/code-mode-e2b-search-tools-parity.md, line 2:
<comment>`search_tools()` changes from an array to `{ meta, results }`, so existing E2B snippets using `.map`, `for...of`, or array destructuring now fail. This is a breaking `@mcp-use/client` contract; use a major bump or preserve array compatibility instead of publishing it as minor.</comment>
<file context>
@@ -0,0 +1,5 @@
+---
+"@mcp-use/client": minor
+---
+
</file context>
| "@mcp-use/client": minor | |
| "@mcp-use/client": major |
TypeScript Conformance (current head)Runner: Score: 2006/2012 passed (6 expected failures, 0 unexpected failures, 4 expected warnings, 0 unexpected warnings)
|
|
Keeping
|
3d27904 to
d34c48b
Compare
There was a problem hiding this comment.
All reported issues were addressed across 2 files (changes from recent commits).
Reply with feedback, questions, or to request a fix.
View guided diff | Re-trigger cubic
`BaseCodeExecutor.createSearchToolsFunction()` (used by the VM executor) and
the `searchTools()` API both return a `ToolSearchResponse`
(`{ meta: { total_tools, namespaces, result_count }, results }`), and the
exported code-mode agent prompt reads a `results` array. The E2B shim returned
a bare array for `full` and plain arrays for `names`/`descriptions`, without
`meta`, and did not match the query against the server name, so the same
snippet behaved differently depending on the executor and the prompt's
`for (const tool of tools)` loop failed on the VM.
Generate the same document in the E2B shim: `{ meta, results }` for every
detail level, server-name matching in the query, and sorted `namespaces`.
The shim keeps searching the full records before projecting to the requested
detail level, which is the order mcp-use#2728 applies to the VM executor (the VM still
projects first on main). Update the prompt examples and the API page to read
`.results`.
Co-Authored-By: Claude Code <[email protected]>
d34c48b to
f952daa
Compare
|
Addressed the P2 in |
Pull Request Description
Where did you find this issue?
Code mode has two executors (local VM and E2B) and a documented discovery helper,
search_tools(). The VM executor and thesearchTools()API return aToolSearchResponse:The E2B executor's shim returned a bare array, and the exported
CODE_MODE_AGENT_PROMPTiterates it as an array:So a snippet written the way the prompt (and the docs) show runs on E2B and fails on the VM, and
metais unavailable on E2B. The E2B shim also only matched the query against a tool's name and description, while the VM path also matches the server name.Reproduced on
main(8d8034e) with the tests in this PR (all three fail before the change).Language / Project Scope
Changes
E2BCodeExecutor.generateShim()now emits asearch_tools()that returns the same{ meta, results }envelope asBaseCodeExecutor.createSearchToolsFunction()andsearchTools()— for every detail level, withtotal_tools, sortednamespacesandresult_count, and server-name matching in the query.maintoday the VM still projects first, so a description-only match at thenameslevel is currently found on E2B but not on the VM — that gap closes when fix(client): preserve description matches in names-only tool search #2728 lands, and this PR deliberately keeps E2B's behavior instead of copying the bug.CODE_MODE_AGENT_PROMPTexamples readresults(and destructure it) instead of iterating the return value.docs/typescript/api-reference/client/code-mode.mdxstates that the in-sandbox helper returns the same{ meta, results }envelope on both executors, and that which tools a query matches can still differ until fix(client): preserve description matches in names-only tool search #2728 lands.packages/client/tests/unit/client/code-mode-search-tools-parity.test.ts: three compare the shim's output with the VM implementation directly, and one asserts the search-then-project order that fix(client): preserve description matches in names-only tool search #2728 gives the VM.@mcp-use/clientminor — the E2B helper's return shape changes for anyone who used the old array form.Implementation Details
meta.total_toolscounts all tools in the catalog (not the filtered list),meta.namespacesis the sorted list of servers that have tools, andmeta.result_countis the filtered length — copied fromcreateSearchToolsFunction()so the two implementations stay comparable. Thecode_modeself-server is already excluded bygetToolNamespaces(), which feeds both paths.names→{name, server},descriptions→{name, server, description},full→ the full record withinput_schema); only the envelope is added.searchTools(); the shim now matches the type it already documented.Coordination with other open PRs
preserve description matches in names-only tool search) changes the VM to search full records before projecting. This PR keeps E2B on that same order, so the two agree once fix(client): preserve description matches in names-only tool search #2728 merges; today the VM still projects first, which is the single intentional difference between the executors (a description-only match at thenameslevel). No change is needed here after fix(client): preserve description matches in names-only tool search #2728.global.search_toolsshim (its hunk does not apply on this commit). Its Jev early-return emitsresponse.results(a bare array); it should return the same{ meta, results }envelope to avoid reintroducing the inconsistency this PR removes.search_tools(null)now throws (like the VM), where the old shim returned every tool because it only tested!queryinside the filter.undefined/omitted still returns everything.TypeScript Checklist
Packages Modified
docstestsclicreate-mcp-use-appmcp-use(server)mcp-use(client)inspectorPre-commit Checklist
pnpm lint:fix/eslinton the changed filespnpm format(Prettier)pnpm buildand it succeeds (@mcp-use/client)pnpm changesetExample Usage (Before)
Example Usage (After)
Testing
packages/client/tests/unit/client/code-mode-search-tools-parity.test.ts— 4 tests on the evaluated E2B shim: default query, server-name match and all three detail levels compared withVMCodeExecutor.createSearchToolsFunction(), plus the search-then-project order (found at thenameslevel; not compared with today's VM, see fix(client): preserve description matches in names-only tool search #2728). All four fail on8d8034eand pass with the change.tsc --noEmit,eslint,prettier: clean.pnpm --filter @mcp-use/client build: success.Backwards Compatibility
The E2B
search_tools()helper's return value changes from an array to the{ meta, results }object that the VM executor,searchTools()and the API docs already describe. A snippet that iterated the array directly must read.results; snippets written against the prompt examples already do after this change. The changeset is markedminorfor that reason.Related Issues
No existing issue covers this. Related open PRs: #2964 (the same executor-parity class of bug for server namespaces) and #2728 (VM side of the search-then-project order).