aixplain.modules.model.mcp_connection
ConnectAction Objects
class ConnectAction()
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:
nameText - The display name of the action.descriptionText - A detailed description of what the action does.codeOptional[Text] - The internal code/identifier for the action. Defaults to None.inputsOptional[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)
Initialize a new ConnectAction instance.
Arguments:
nameText - The display name of the action.descriptionText - A detailed description of what the action does.codeOptional[Text], optional - The internal code/identifier for the action. Defaults to None.inputsOptional[Dict], optional - The input parameters required by the action. Defaults to None.
__repr__
def __repr__()
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)
__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
Initialize a new MCPConnection instance.
Arguments:
idText - ID of the MCP Connection.nameText - Name of the MCP Connection.descriptionText, optional - Description of the Connection. Defaults to "".api_keyText, optional - API key for the Connection. Defaults to None.supplierUnion[Dict, Text, Supplier, int], optional - Supplier of the Connection. Defaults to "aiXplain".versionText, optional - Version of the Connection. Defaults to "1.0".functionFunction, optional - Function of the Connection. Defaults to None.is_subscribedbool, optional - Whether the user is subscribed. Defaults to False.costDict, optional - Cost of the Connection. Defaults to None.function_typeFunctionType, 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])
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:
actionUnion[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.