# convert_mcp_tool_to_langchain_tool

> **Function** in `langchain_mcp_adapters`

📖 [View in docs](https://reference.langchain.com/python/langchain-mcp-adapters/tools/convert_mcp_tool_to_langchain_tool)

Convert an MCP tool to a LangChain tool.

NOTE: this tool can be executed only in a context of an active MCP client session.

## Signature

```python
convert_mcp_tool_to_langchain_tool(
    session: ClientSession | None,
    tool: MCPTool,
    *,
    connection: Connection | None = None,
    callbacks: Callbacks | None = None,
    tool_interceptors: list[ToolCallInterceptor] | None = None,
    server_name: str | None = None,
    tool_name_prefix: bool = False,
) -> BaseTool
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `session` | `ClientSession \| None` | Yes | MCP client session |
| `tool` | `MCPTool` | Yes | MCP tool to convert |
| `connection` | `Connection \| None` | No | Optional connection config to use to create a new session         if a `session` is not provided (default: `None`) |
| `callbacks` | `Callbacks \| None` | No | Optional callbacks for handling notifications and events (default: `None`) |
| `tool_interceptors` | `list[ToolCallInterceptor] \| None` | No | Optional list of interceptors for tool call processing (default: `None`) |
| `server_name` | `str \| None` | No | Name of the server this tool belongs to (default: `None`) |
| `tool_name_prefix` | `bool` | No | If `True` and `server_name` is provided, the tool name will be prefixed w/ server name (e.g., `"weather_search"` instead of `"search"`) (default: `False`) |

## Returns

`BaseTool`

a LangChain tool

---

[View source on GitHub](https://github.com/langchain-ai/langchain-mcp-adapters/blob/8f580f029fabd78891ea4dbfd1de3b1d9e4fa001/langchain_mcp_adapters/tools.py#L272)