Skip to main content
Base adapter interface for MCP tools. This module provides the abstract base class that all MCP tool adapters should inherit from.

BaseAdapter

Attributes
str
required
String value

method init

Initialize a new adapter.Parameters
list[str] | None
default:"None"
list of tool names that should not be available.
Signature

method create_all

Create tools, resources, and prompts from an MCPClient instance.Parameters
mcp_use.client.client.MCPClient
required
MCP client instance
Signature

method create_prompts

Create prompts from the MCPClient instance.This handles session creation and connector extraction automatically. The created prompts are stored in self.prompts.Parameters
mcp_use.client.client.MCPClient
required
MCP client instance
Returns
list[mcp_use.agents.adapters.base.T]
A list of prompts in the target framework’s format.
Signature

method create_resources

Create resources from the MCPClient instance.This handles session creation and connector extraction automatically. The created resources are stored in self.resources.Parameters
mcp_use.client.client.MCPClient
required
MCP client instance
Returns
list[mcp_use.agents.adapters.base.T]
A list of resources in the target framework’s format.
Signature

method create_tools

Create tools from the MCPClient instance.This handles session creation and connector extraction automatically. The created tools are stored in self.tools.Parameters
mcp_use.client.client.MCPClient
required
MCP client instance
Returns
list[mcp_use.agents.adapters.base.T]
A list of tools in the target framework’s format.
Signature

method fix_schema

Convert JSON Schema ‘type’: [‘string’, ‘null’] to ‘anyOf’ format and fix enum handling.Parameters
Any
required
The JSON schema to fix.
Returns
Any
The fixed JSON schema.
Signature

method load_prompts_for_connector

Dynamically load prompts for a specific connector.Parameters
mcp_use.client.connectors.base.BaseConnector
required
The connector to load prompts for.
Returns
list[mcp_use.agents.adapters.base.T]
The list of prompts that were loaded in the target framework’s format.
Signature

method load_resources_for_connector

Dynamically load resources for a specific connector.Parameters
mcp_use.client.connectors.base.BaseConnector
required
The connector to load resources for.
Signature

method load_tools_for_connector

Dynamically load tools for a specific connector.Parameters
mcp_use.client.connectors.base.BaseConnector
required
The connector to load tools for.
Returns
list[mcp_use.agents.adapters.base.T]
The list of tools that were loaded in the target framework’s format.
Signature

method parse_result

Parse the result from any MCP operation (tool, resource, or prompt) into a string.Parameters
Any
required
The result object from an MCP operation.
Returns
str
A string representation of the result content.
Signature