Skip to content

fix(core): warn when /mcp serves an empty tool list - #157

Open
lipowen wants to merge 1 commit into
junebuild:mainfrom
lipowen:fix/mcp-empty-tools-warning
Open

fix(core): warn when /mcp serves an empty tool list#157
lipowen wants to merge 1 commit into
junebuild:mainfrom
lipowen:fix/mcp-empty-tools-warning

Conversation

@lipowen

@lipowen lipowen commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

An enabled /mcp surface that returns zero tools is almost always the silent no-op where a defineAction() sits in a file the app graph never imports — a standalone app/actions.ts is not auto-loaded, so tools/list returns [] 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/list now warns once per process when it serves an empty tool set, pointing to the fix:

[june] /mcp exposes no tools — no defineAction() with a description is registered. Agent tools live in agent/tools/*.ts (each default-exports a defineAction); a standalone app/actions.ts is not auto-loaded into the app graph.

Why this placement

Reaching the tools/list handler proves /mcp is 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 before agent/tools/*.ts are discovered and false-positive on a correct app; the request handler is the timing-safe point. The JSON-RPC batch path routes through the same handle(), so batched tools/list is covered too.

The warning matches the codebase's [june] <state> — <fix path> voice, fires once per isolate, and cites no fabricated issue number. __resetEmptyToolsWarning is a test-only export so the assertion isn't order-dependent across the monorepo test run.

Tests

  • tools/list on an empty registry warns and points to agent/tools/*.ts.
  • Existing tools/list / tools/call behavior unchanged (non-empty surface never warns).

Changeset: @junejs/core patch.

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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a one-time diagnostic warning when /mcp exposes no tools.

Changes:

  • Warns once when tools/list returns 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");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants