fix(core): warn when /mcp serves an empty tool list - #157
Open
lipowen wants to merge 1 commit into
Open
Conversation
An enabled /mcp surface returning zero tools is the silent no-op where a defineAction() sits in a file the app graph never imports. tools/list now warns once per process, pointing to the agent/tools/*.ts convention, instead of returning [] with no signal.
There was a problem hiding this comment.
Pull request overview
Adds a one-time diagnostic warning when /mcp exposes no tools.
Changes:
- Warns once when
tools/listreturns an empty set. - Adds warning coverage and a test reset hook.
- Documents the patch release.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
packages/core/src/mcp.ts |
Implements the guarded warning. |
packages/core/test/mcp.test.ts |
Tests empty-tool diagnostics. |
.changeset/mcp-empty-tools-warning.md |
Documents the behavior change. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+65
to
+72
| try { | ||
| const res = await mcpHandler(rpc({ jsonrpc: "2.0", id: 6, method: "tools/list" })); | ||
| const json = (await res.json()) as any; | ||
| expect(json.result.tools).toHaveLength(0); | ||
| } finally { | ||
| console.warn = origWarn; | ||
| } | ||
| expect(warnings.join("\n")).toContain("agent/tools/*.ts"); |
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.
An enabled
/mcpsurface that returns zero tools is almost always the silent no-op where adefineAction()sits in a file the app graph never imports — a standaloneapp/actions.tsis not auto-loaded, sotools/listreturns[]with no signal and the misconfiguration surfaces only as "my agent sees no tools". This was a real dead-end while building an agent app on June: the flagship actions→MCP feature no-ops for the most natural file layout, with nothing to point at.Change
tools/listnow warns once per process when it serves an empty tool set, pointing to the fix:Why this placement
Reaching the
tools/listhandler proves/mcpis mounted (enabled) and the surface is authoritatively empty — everything (routes via warmup, agent-dir tools via the lazily-built pipeline) has registered by request time. A warn at warmup time would fire beforeagent/tools/*.tsare discovered and false-positive on a correct app; the request handler is the timing-safe point. The JSON-RPC batch path routes through the samehandle(), so batchedtools/listis covered too.The warning matches the codebase's
[june] <state> — <fix path>voice, fires once per isolate, and cites no fabricated issue number.__resetEmptyToolsWarningis a test-only export so the assertion isn't order-dependent across the monorepo test run.Tests
tools/liston an empty registry warns and points toagent/tools/*.ts.tools/list/tools/callbehavior unchanged (non-empty surface never warns).Changeset:
@junejs/corepatch.