copilot-cli icon indicating copy to clipboard operation
copilot-cli copied to clipboard

Repeated MCP discovery reports "Found 0 tools" for an already-loaded namespace

Open m-nash opened this issue 2 months ago • 4 comments

Summary

Repeated model-side MCP tool discovery reports "Found 0 tools" for a namespace whose tool definitions were already loaded. This misleading result caused the agent to declare a working integration unavailable and skip a required workflow step.

Environment

  • Copilot CLI 1.0.84-2
  • Windows
  • Local stdio MCP server exposing four tools

Reproduction

  1. In a fresh session, discover the configured MCP namespace. In this case, the call was api_tool.list_resources({"paths":["pr-copilot"]}).
  2. Observe "Found 4 tools" and all four tool definitions being loaded.
  3. Repeat the identical discovery call without changing MCP configuration.
  4. Observe "Found 0 tools", despite the previously loaded definitions remaining in context.

This was reproduced in a separate session after investigating the original failure.

Actual behavior and impact

The affected session already had all four schemas in its request history. Two later discovery responses completed with tools: []. The agent then reported: "The PR-monitor integration currently exposes no tools, so I can't start it."

The empty responses were real; the incorrect inference was that no tools were available. This report concerns model-side discovery, not a claim that the MCP server's raw tools/list returned an empty list. No stateful monitor invocation was needed to reproduce the discovery behavior.

Expected behavior

A repeated lookup should either return the existing tool definitions or explicitly report that the tools are already loaded, including their names/count. "No additional definitions to load" must be distinguishable from "no matching or available tools", so the agent does not abandon an available integration.


🤖 m-nash-copilot

m-nash avatar Sep 08 '26 22:09 m-nash

@m-nash I'm looking at this because the repeated Found 0 tools result against an already-loaded namespace is exactly the kind of failure that's hard to diagnose from the outside. I'm working on an open-source tool-calling debugger and I've frozen the current RC before external testing so I can't tune it around individual reports. If you still have the original pre-debugging session/request data for this failure, would you be willing to share a sanitized copy of the relevant payload/tool catalog and the failing logs? Environment/config details around the MCP namespace would help too. I'd like to try reproducing the same failure identity and run the frozen diagnoser against it, then send you the result and evidence. If you've already figured out the root cause, please don't tell me yet — just let me know it's known so I don't treat the case as blind validation. No credentials or private project data needed.

aldi949 avatar Sep 09 '26 19:09 aldi949

Additional reproduction in the GitHub Copilot desktop app, possibly related:

Environment: Windows; Copilot desktop app 1.4.2; local stdio MCP server with two tools. No server, authentication, or approval settings were changed during the tests.

Observed:

  • In a long-running session, an MCP inference tool had successfully run earlier. A later model request contained the earlier namespace and both tool schemas in its conversation history, but a new api_tool.list_resources search for that namespace returned zero tools. The agent reported it could not select the tool; no inference call was made in that later turn.
  • In a separate local chat, the same search returned zero twice, yet that chat could still invoke both an already-loaded status tool and an inference tool successfully. The inference test used synthetic input only.

This confirms that an empty repeat search alone is not a reliable indication that an MCP server is unavailable. It also suggests the distinction between historical schemas and tools actually callable by a later turn is worth investigating. The logs do not establish why the affected session could not select the tool, or whether the underlying cause is identical to this issue. These are model-side searches, not evidence that the server's own tools/list returned empty.

MamoruKuroda avatar Nov 15 '26 06:11 MamoruKuroda

I reproduced this with GitHub Copilot CLI 1.0.113-1 on macOS using only the built-in GitHub MCP server: discovery returns a tool definition on the first turn, but the identical search returns Found 0 tools on a later turn, while a previously untouched tool remains discoverable.

Consequence

The ambiguity is that Found 0 tools does not distinguish an already-loaded match from a genuine no-match. An agent that interprets the response as tool unavailability may incorrectly tell the user it cannot complete a request without trying the already-loaded tool. The reproduction below tests discovery only; it does not demonstrate a CLI crash or a GitHub tool-execution failure.

Isolated reproduction

I ran the tests in a fresh CLI instance launched from an empty directory containing no workspace files, with only github-mcp-server enabled and tool search active. Other MCP servers were disabled for that process only. The model remained GPT-6.1 Sol with long_context and medium effort throughout the reproduction. There were no intervening model or context changes, MCP reloads, authentication changes, or configuration edits.

These are agent-facing tool-discovery calls, not shell commands. They retrieve definitions only. Ask the agent not to invoke any returned GitHub tools, and do not inventory the whole server before the untouched-tool control.

  1. In the first user turn, ask the agent to call api_tool.list_resources({"paths":["github-mcp-server"],"query":"search_users"}) twice. Both calls return one definition, github-mcp-server-search_users.
  2. In a new user turn in the same CLI session, repeat that exact call once. It returns Found 0 tools.
  3. In that second turn, call api_tool.list_resources({"paths":["github-mcp-server"],"query":"get_file_contents"}), which was not searched for on the first turn. It returns one definition, github-mcp-server-get_file_contents.

Here, a turn means one user prompt and the agent's response, including its discovery calls. The complete result matrix from that isolated session was:

Discovery arguments First turn Repeat within first turn Next turn
{"paths":["github-mcp-server"],"query":"search_users"} 1 tool 1 tool, identical name 0 tools
{"paths":["github-mcp-server"],"query":"get_file_contents"} Not searched Not searched 1 tool

The tool-search documentation says loaded definitions remain available for the conversation; it does not promise that later searches will return them again. The results are consistent with searches exposing only definitions that still need to be loaded. A zero-result lookup therefore does not, by itself, demonstrate tool unavailability or a violated discovery contract.

Additional evidence and limits

Both outgoing model-request records in the GitHub-only reproduction had identical sanitized tool-catalog fingerprint metadata: count, deferral count, digest, canonical digest, and the per-tool/namespace fingerprint list. The GitHub MCP server was the only MCP server represented in both catalogs. The local session event log contained no tool.execution_start records despite the discovery lookups. These observations do not establish where filtering occurred, whether the underlying discovery state was unchanged, or whether the absence of local execution records reflects upstream handling or the logging behavior.

No returned GitHub tools were invoked, so this test does not establish whether they could still be executed after disappearing from discovery. It does establish that a model switch is not necessary to reproduce the search-result change. I have not established whether the omission is intentional loaded-definition filtering or a bookkeeping defect.

Requested clarification

Is later-turn exclusion of already-loaded definitions intentional? If so, could the response explicitly distinguish "matching definitions already loaded" from "no matching tools"? Returning matching definitions again would be another option. This is a proposed usability improvement, not a claim that the documentation guarantees rediscovery. If the empty result is unintended, the unchanged outgoing catalog fingerprints may help locate where the state diverges. I am not proposing changes to MCP server implementations based on this evidence.

Environment

  • GitHub Copilot CLI 1.0.113-1, installed executable reporting that version.
  • macOS 26.7.3, Apple Silicon.
  • GPT-6.1 Sol, long_context, medium reasoning effort.
  • Built-in GitHub MCP server (github-mcp-server) only, with tool search active.
  • Fresh CLI session in an empty directory. User-level configuration and installed plugins were retained, with other MCP servers disabled for this launch; this was not a clean-profile test.

mokshadharma avatar Nov 18 '26 01:11 mokshadharma

Thanks for the reports and repros, including on 1.0.113. Tools that are already loaded are left out of later tool-search results, so a repeated search returns "Found 0 tools" and looks like a genuine no-match. We've confirmed this and moved it to the backlog, so results will say when matching tools are already loaded.

hstaudacher avatar Nov 18 '26 16:11 hstaudacher