Skip to content

Commit 015fef8

Browse files
committed
docs: describe the chat context indicator's MCP discovery states
The sentence moves here from the gating layer because this layer renders those states. Add the story for a chat whose agent has not pushed its first snapshot, where the indicator shows only that discovery is underway.
1 parent 36959d0 commit 015fef8

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

docs/ai-coder/agents/extending-agents.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ The agent connects to the servers declared in `.mcp.json` once startup scripts f
224224
A chat turn waits up to 15 seconds for that initial discovery to finish so the model sees the workspace tools; if discovery takes longer, the turn continues with whatever has been discovered so far.
225225
Each server is published as soon as it connects, so one slow or unresponsive server does not hold back the tools of the others.
226226
Servers that fail to connect are listed with their error, servers that connect with no tools are still listed, and the rest contribute their tools.
227+
The chat's context indicator shows whether discovery is still initializing, has completed, or still describes a previous agent process after a restart.
227228

228229
A single set of connections is shared by tool discovery and tool execution, so each declared server is launched once.
229230
When the connected tool list changes, the agent re-scans and pushes a new snapshot.

site/src/pages/AgentsPage/components/ContextUsageIndicator.stories.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,26 @@ export const McpDiscoveryInitializing: Story = {
275275
},
276276
};
277277

278+
// A chat bound to an agent that has not pushed its first snapshot yet: the
279+
// only thing to show is that discovery is underway.
280+
export const McpDiscoveryInitializingBeforeFirstSnapshot: Story = {
281+
args: {
282+
usage: {
283+
usedTokens: 12_000,
284+
contextLimitTokens: 200_000,
285+
context: {
286+
...MockChatContextClean,
287+
resources: [],
288+
mcp_discovery: { phase: "pending", stale: false },
289+
},
290+
},
291+
},
292+
play: async ({ canvasElement }) => {
293+
const button = within(canvasElement).getByRole("button");
294+
await userEvent.hover(button);
295+
},
296+
};
297+
278298
// Discovery finished and no server was declared, so the section states that
279299
// outcome rather than disappearing.
280300
export const McpDiscoveryCompleteNoServers: Story = {

0 commit comments

Comments
 (0)