load_mcp_tools(
session: ClientSession | None,
*,
connection: Connection | None = None,
callbacks| Name | Type | Description |
|---|---|---|
session* | ClientSession | None | The MCP client session. If |
connection | Connection | None | Default: NoneConnection config to create a new session if session is |
callbacks | Callbacks | None | Default: NoneOptional |
tool_interceptors | list[ToolCallInterceptor] | None | Default: None |
server_name | str | None | Default: None |
tool_name_prefix | bool | Default: False |
handle_tool_errors | bool | Default: True |
Load all available MCP tools and convert them to LangChain tools.
Optional list of interceptors for tool call processing.
Name of the server these tools belong to.
If True and server_name is provided, tool names will be
prefixed w/ server name (e.g., "weather_search" instead of "search").
If True (default), an MCP tool execution error
(CallToolResult(isError=True)) is returned to the model as a
ToolMessage with status="error" so the agent can self-correct
instead of crashing the run. If False, a ToolException is raised
instead (legacy behavior). Transport/session failures and
content-conversion errors (e.g. unsupported audio content) always
raise regardless of this setting; only MCP execution errors
(isError=True) are governed by it.