Skip to content

Preload MCP server tools into the initial agent function list (instead of lazy discovery) #3787

@tamirdresher

Description

@tamirdresher

Summary

When a session starts, MCP tools registered via .mcp.json or --additional-mcp-config are lazy-loaded — they are not advertised in the agent's initial <available_tools> list. Agents that don't know to probe for them (via tool_search_tool_regex or similar discovery) will not see they exist and may resort to less-appropriate built-in tools instead.

Concrete failure mode we hit

We ship a custom MCP server (squad_state) with Squad that exposes 13 tools (7 squad_state_* + 6 memory.*). Squad agents are supposed to use these to write durable team state (decisions, agent history, governed memory) instead of raw create / edit / write_file against on-disk files.

What we observed across multiple agent sessions:

"My session loaded with powershell, view, create, edit, grep, glob, task, store_memory, vote_memory, etc. — the squad MCP tools (squad_state-*) were registered but not advertised in the tool definitions block at the top of my prompt. I only found them just now by running tool_search_tool_regex."

Behaviour: agent silently writes .squad/decisions.md with create even though the contract requires going through squad_state_write. On a two-layer state backend (orphan branch + git notes) that write either fails at the pre-commit hook or creates phantom state the runtime overwrites at next read — silent data loss.

We worked around it with a documented "state-backend handshake" in the coordinator prompt that forces the agent to probe for the tools at session start (see bradygaster/squad#1306). But this is defence in depth — the prompt cost shouldn't be necessary if the tools were in the initial function list.

Request

Advertise tools from .mcp.json / --additional-mcp-config-loaded MCP servers in the agent's initial <available_tools> list at session start, instead of (or in addition to) lazy discovery.

Optional refinements:

  1. Opt-in per server — add a "preload": true flag to the MCP server entry so server authors can mark a server as eager-load.
  2. Logging on connect — print a one-line ⚙️ MCP server X connected; advertised N tools on stdout/stderr at session start so users see which servers loaded without having to inspect ~/.copilot/logs/.
  3. Optional initial system-reminder banner when external MCP tools are detected: External MCP tools available: X, Y, Z. Use these for the operations they cover. This nudges agents that don't proactively probe.

Why this matters for the broader ecosystem

This isn't a Squad-specific request. Any third party who ships a custom MCP server (memory, vector store, code-intelligence, telemetry, custom CI) hits the same wall: their tools exist but the agent doesn't know to ask. The pattern of "register an MCP server then hope the agent probes for it" is fragile and produces inconsistent agent behaviour across sessions.

Closing this would let MCP-server authors trust that .mcp.json registration is enough — no per-prompt nudges needed.

Repro

  1. npm i -g @bradygaster/squad-cli@insider
  2. mkdir test && cd test && git init && squad init
  3. copilot --agent squad --allow-all-tools -p "list every tool you can call right now"
  4. Observe: squad_state_* / memory.* tools are NOT in the initial response. They are only discoverable via tool_search_tool_regex or by reading the .mcp.json.

Tested on Copilot CLI v1.0.62-2 (Windows 11, Node v24.14.0).

Filed by

Squad maintainer team, surfaced during v0.10 stabilisation effort.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions