# resolve_and_load_mcp_tools

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/mcp_tools/resolve_and_load_mcp_tools)

Resolve MCP config and load tools.

Auto-discovers configs from standard locations and merges them. When
`explicit_config_path` is provided it is added as the highest-precedence
source and errors in that file are fatal.

## Signature

```python
resolve_and_load_mcp_tools(
    *,
    explicit_config_path: str | None = None,
    no_mcp: bool = False,
    trust_project_mcp: bool | None = None,
    project_context: ProjectContext | None = None,
    stateless: bool = False,
    session_manager: MCPSessionManager | None = None,
) -> tuple[list[BaseTool], MCPSessionManager | None, list[MCPServerInfo]]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `explicit_config_path` | `str \| None` | No | Extra config file to layer on top of auto-discovered configs. (default: `None`) |
| `no_mcp` | `bool` | No | If `True`, disable all MCP loading. (default: `False`) |
| `trust_project_mcp` | `bool \| None` | No | Controls project-level stdio server trust.  - `True`: always trust project configs, including stdio servers. - `False`: drop stdio entries from project configs. - `None`: consult the persistent trust store — trusted configs   load fully, untrusted project stdio servers are dropped. (default: `None`) |
| `project_context` | `ProjectContext \| None` | No | Explicit project path context for config discovery and trust resolution. (default: `None`) |
| `stateless` | `bool` | No | When `True`, do not return an owned runtime session manager. (default: `False`) |
| `session_manager` | `MCPSessionManager \| None` | No | Optional externally owned runtime session manager. (default: `None`) |

## Returns

`tuple[list[BaseTool], MCPSessionManager | None, list[MCPServerInfo]]`

Tuple of `(tools_list, session_manager, server_infos)`.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/d1c6946218b4f0f86ab7b02b6bb6af1e4b75cede/libs/code/deepagents_code/mcp_tools.py#L1577)