Enumerate the tools available to the agent for dcode tools list.
The tool set is read from the real tool objects the agent binds rather than a hand-maintained catalog, so names and descriptions never drift from what the model actually sees. Built-in tools are collected by compiling the agent with a throwaway offline chat model (no credentials, no network) and reading the bound tool node; MCP tools are discovered via the same path the app and server use.
The collection functions here lazily import the heavy agent stack (agent
compilation, MCP discovery) inside their bodies. Only the fake-model base is
imported at module top, so importing this module is cheap relative to the agent
stack — and this module is itself imported lazily inside _run_tools_list,
never on the startup hot path. Those functions must only run on the
dcode tools list command path.
Load states a configured MCP server can end up in.
ok means the server loaded successfully and has an authoritative tool list.
unauthenticated means the server requires OAuth login before tools can load.
error means the server failed to load after a connection or configuration
failure.
disabled is set when the user has turned the server off via the TUI
(/mcp -> F2). No connection is attempted and no tools are loaded, but
the entry is still surfaced in the viewer so the user can re-enable it.
awaiting_reconnect is a transient UI-only state used after OAuth login
has succeeded but before the LangGraph server has restarted and loaded
the newly available MCP tools.
Stable source token identifying where a tool group comes from.
Emitted verbatim in the --json output, so it is a public contract; keep it a
Literal of stable tokens (not a bare str), following the same convention as
mcp_tools.MCPServerStatus.
Display label for the group of tools bundled with deepagents-code.
Enumerate the built-in tools the agent binds by default.
Compiles the agent with an offline placeholder model and reads the bound
tool node. Memory and skills are disabled because they contribute no tools
(they only augment the system prompt). The selected assistant id is still
forwarded so agent-specific subagents are loaded from the same directory the
normal launch path uses. The custom CLI tools are included the same way
server_graph._build_tools adds them, so web_search appears only when
Tavily is configured.
Discover MCP servers, split into tool groups and unavailable servers.
Best-effort: if discovery itself raises (no config, offline, load error),
the technical detail is logged and a generic mcp_error message is
returned so dcode tools list still renders the built-in tools while
telling the user discovery failed. Servers that loaded but expose no tools
are reported as UnavailableServers (errored, needing login, or disabled)
rather than silently dropped — surfacing exactly what a user running this
command to debug a missing tool needs to see.
Collect everything dcode tools list renders.