Skip to main content
Version: 1.0

aixplain.modules.model.mcp_connection

ConnectAction Objects

class ConnectAction()

[view_source]

A class representing an action that can be performed by an MCP connection.

This class defines the structure of a connection action with its name, description, code, and input parameters.

Attributes:

  • name Text - The display name of the action.
  • description Text - A detailed description of what the action does.
  • code Optional[Text] - The internal code/identifier for the action. Defaults to None.
  • inputs Optional[Dict] - The input parameters required by the action. Defaults to None.

__init__

def __init__(name: Text,
description: Text,
code: Optional[Text] = None,
inputs: Optional[Dict] = None)

[view_source]

Initialize a new ConnectAction instance.

Arguments:

  • name Text - The display name of the action.
  • description Text - A detailed description of what the action does.
  • code Optional[Text], optional - The internal code/identifier for the action. Defaults to None.
  • inputs Optional[Dict], optional - The input parameters required by the action. Defaults to None.

__repr__

def __repr__()

[view_source]

Return a string representation of the ConnectAction instance.

Returns:

  • str - A string in the format "Action(code=<code>, name=<name>)".

MCPConnection Objects

class MCPConnection(ConnectionTool)

[view_source]

__init__

def __init__(id: Text,
name: Text,
description: Text = "",
api_key: Optional[Text] = None,
supplier: Union[Dict, Text, Supplier, int] = "aiXplain",
version: Optional[Text] = None,
function: Optional[Function] = None,
is_subscribed: bool = False,
cost: Optional[Dict] = None,
function_type: Optional[FunctionType] = FunctionType.CONNECTION,
**additional_info) -> None

[view_source]

Initialize a new MCPConnection instance.

Arguments:

  • id Text - ID of the MCP Connection.
  • name Text - Name of the MCP Connection.
  • description Text, optional - Description of the Connection. Defaults to "".
  • api_key Text, optional - API key for the Connection. Defaults to None.
  • supplier Union[Dict, Text, Supplier, int], optional - Supplier of the Connection. Defaults to "aiXplain".
  • version Text, optional - Version of the Connection. Defaults to "1.0".
  • function Function, optional - Function of the Connection. Defaults to None.
  • is_subscribed bool, optional - Whether the user is subscribed. Defaults to False.
  • cost Dict, optional - Cost of the Connection. Defaults to None.
  • function_type FunctionType, optional - Type of the function. Must be FunctionType.MCP_CONNECTION. Defaults to FunctionType.CONNECTION.
  • name0 - Any additional Connection info to be saved.

Raises:

  • name1 - If function_type is not FunctionType.MCP_CONNECTION.

get_action_inputs

def get_action_inputs(action: Union[ConnectAction, Text])

[view_source]

Retrieve the input parameters required for a specific tool.

This method fetches the input parameters that are required to use a specific tool. If the action object already has its inputs cached, returns those instead of making a server request.

Arguments:

  • action Union[ConnectAction, Text] - The tool to get inputs for, either as a ConnectAction object or as a string code.

Returns:

  • Dict - A dictionary mapping input parameter codes to their specifications.

Raises:

  • Exception - If the inputs cannot be retrieved from the server or if the response cannot be parsed.