Skip to content

Nested custom agent MCP tools depend on undocumented immediate-parent grants starting in CLI 1.0.74 #4320

Description

@brian-kelley-intel

Describe the bug

A custom agent invoked two levels below the session root does not receive the MCP tools declared in its own tools: frontmatter as described in the Copilot CLI documentation. If a middle-level agent declares the tool (e.g. repro-mcp/echo), then the leaf agent receives the tool and succeeds.

The same leaf agent can call its MCP tool when selected directly. It can also call the tool through the nested agent chain on Copilot CLI 1.0.73. Starting with 1.0.74, the nested leaf LLM receives only the built-in view tool. The CLI does not report a configuration error; the leaf agent executes without the MCP tool.

Declaring repro-mcp/echo only on the top-level root does not help without the cooresponding middle-level tool change. The leaf still receives only view. The observed rule depends on the leaf's immediate parent.

Agent chain:

nested-root
└── nested-coordinator
    └── nested-leaf
        └── tool(repro-mcp/echo)

Affected version

GitHub Copilot CLI 1.0.74. This is a regression from GitHub Copilot CLI 1.0.73.

Steps to reproduce the behavior

1. Register the attached MCP server

Save the attached mcp-server.mjs, then create $COPILOT_HOME/mcp-config.json:

{
  "mcpServers": {
    "repro-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server.mjs"],
      "env": {
        "REPRO_CALL_LOG": "/tmp/repro-mcp-calls.jsonl"
      }
    }
  }
}

2. Create three repository agents

.github/agents/nested-root.agent.md

---
name: nested-root
description: Root orchestrator for a nested MCP tool test.
tools: ['agent']
agents: ['nested-coordinator']
---

Use the `agent` tool exactly once to dispatch `nested-coordinator`.

Give it this exact prompt:

`Dispatch nested-leaf and ask it to call its required echo tool with message "nested-probe". Return the leaf response verbatim.`

Do not perform the leaf's work yourself. Return the coordinator response verbatim.

.github/agents/nested-coordinator.agent.md

---
name: nested-coordinator
description: Middle-level coordinator for a nested MCP tool test.
tools: ['agent']
agents: ['nested-leaf']
user-invocable: false
---

Use the `agent` tool exactly once to dispatch `nested-leaf`.

Pass the requested echo message unchanged. Do not perform the leaf's work yourself. Return the leaf response verbatim.

.github/agents/nested-leaf.agent.md

---
name: nested-leaf
description: Leaf agent that must call an MCP echo tool.
tools: ['repro-mcp/echo']
---

You must call `repro-mcp/echo` exactly once with the requested message.

After the call, return exactly the text from the tool result. If the tool is not available, return exactly `TOOL_NOT_AVAILABLE`.

3. Run the direct control

Run from the directory containing .github/agents/:

COPILOT_HOME=/tmp/copilot-1.0.74-home \
COPILOT_AUTO_UPDATE=false \
/path/to/copilot-1.0.74 \
  --agent nested-leaf \
  --allow-all-tools \
  --disable-builtin-mcps \
  --no-custom-instructions \
  --log-level all \
  --log-dir /tmp/copilot-1.0.74-direct-logs \
  -p 'Call your required echo tool with message "direct-probe".'

The direct call succeeds:

MCP_ECHO_OK:direct-probe

4. Run the nested case

COPILOT_HOME=/tmp/copilot-1.0.74-home \
COPILOT_AUTO_UPDATE=false \
/path/to/copilot-1.0.74 \
  --agent nested-root \
  --allow-all-tools \
  --disable-builtin-mcps \
  --no-custom-instructions \
  --log-level all \
  --log-dir /tmp/copilot-1.0.74-nested-logs \
  -p 'Follow your agent instructions exactly and run the nested probe.'

5. Test a top-level-only grant

Change the root agent's tool list while leaving the coordinator unchanged:

-tools: ['agent']
+tools: ['agent', 'repro-mcp/echo']

Run the command from step 4 again. On 1.0.74, the leaf still reports TOOL_NOT_AVAILABLE.

6. Test an immediate-parent grant

Restore the root agent to tools: ['agent'], then change one line in nested-coordinator.agent.md:

-tools: ['agent']
+tools: ['agent', 'repro-mcp/echo']

Do not change nested-leaf.agent.md. Run the command from step 4 again.

The coordinator's instructions still require it to delegate rather than call repro-mcp/echo itself.

7. Repeat steps 3 through 6 with Copilot CLI 1.0.73

Use a separate COPILOT_HOME containing the same MCP configuration. Keep COPILOT_AUTO_UPDATE=false so each command runs the requested version.

Expected behavior

Actual behavior

The direct leaf call succeeds on both versions. On 1.0.74, the nested result depends specifically on whether the immediate coordinator duplicates the leaf's MCP tool declaration:

CLI version Direct leaf No ancestor grant Root-only grant Immediate-parent grant
1.0.73 MCP_ECHO_OK:direct-probe MCP_ECHO_OK:nested-probe MCP_ECHO_OK:nested-probe MCP_ECHO_OK:nested-probe
1.0.74 MCP_ECHO_OK:direct-probe TOOL_NOT_AVAILABLE TOOL_NOT_AVAILABLE MCP_ECHO_OK:nested-probe

The 1.0.74 nested leaf returns:

I don't have access to the `repro-mcp/echo` tool in my available functions. The only tool available to me is the `view` function for viewing files and directories.

TOOL_NOT_AVAILABLE

The redacted debug logs show the filtered tool list sent to the nested leaf:

1.0.73 nested leaf tools:
  view
  repro-mcp-echo (MCP: repro-mcp/echo)

1.0.74 nested leaf tools:
  view

1.0.74 nested leaf tools after adding repro-mcp/echo only to the root:
  view

1.0.74 nested leaf tools after adding repro-mcp/echo to the coordinator:
  view
  repro-mcp-echo (MCP: repro-mcp/echo)

The 1.0.73 events.jsonl records a repro-mcp-echo request and successful completion:

{
  "name": "repro-mcp-echo",
  "mcpServerName": "repro-mcp",
  "mcpToolName": "echo",
  "arguments": {
    "message": "nested-probe"
  }
}
{
  "success": true,
  "result": "MCP_ECHO_OK:nested-probe"
}

The 1.0.74 nested leaf makes zero tool calls. Its events.jsonl contains no repro-mcp-echo request, execution start, or execution completion event.

After the coordinator declares repro-mcp/echo, the 1.0.74 leaf makes one MCP tool call and returns MCP_ECHO_OK:nested-probe.

After only the root declares repro-mcp/echo, the 1.0.74 leaf still makes zero tool calls. This rules out a session-root grant requirement and isolates the behavior to the immediate parent-child boundary.

Expected behavior

A leaf custom agent should receive the tools declared in its own frontmatter when an allowed parent agent dispatches it. A coordinator should not need to repeat every MCP tool declaration from its child agents.

The custom agents configuration reference describes tools as the “list of tool names the custom agent can use.” Its tools-processing section says that a specific list “enables only those tools” for that agent. It does not document inheritance, parent-child intersection, or a requirement that an immediate parent duplicate a child's tools.

The 1.0.74 nested run should expose repro-mcp-echo to nested-leaf and return:

MCP_ECHO_OK:nested-probe

If this behavior is desired rather than an introduced bug, the documentation should be updated to reflect this requirement.

Additional context

Field Value
First affected version tested GitHub Copilot CLI 1.0.74
Working control version GitHub Copilot CLI 1.0.73
OS SUSE Linux Enterprise Server 15 SP4, x86_64
Kernel Linux 5.14.21
Shell bash
MCP server runtime Node.js 24.16.0
Model claude-sonnet-4.5

process-1.0.73-nested-redacted.log
process-1.0.74-nested-parent-grant-redacted.log
process-1.0.74-nested-redacted.log
process-1.0.74-nested-root-grant-redacted.log
mcp-server.mjs.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:agentsSub-agents, fleet, autopilot, plan mode, background agents, and custom agentsarea:mcpMCP server configuration, discovery, connectivity, OAuth, policy, and registry

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions