Documentation Index
Fetch the complete documentation index at: https://docs.camel-ai.org/llms.txt
Use this file to discover all available pages before exploring further.
class KlavisToolkit(BaseToolkit):
A class representing a toolkit for interacting with Klavis API.
This class provides methods for interacting with Klavis MCP server
instances, retrieving server information, managing tools, and handling
authentication.
Parameters:
- api_key (str): The API key for authenticating with Klavis API.
- base_url (str): The base URL for Klavis API endpoints.
- timeout (Optional[float]): The timeout value for API requests in seconds. If None, no timeout is applied. (default: :obj:
None)
init
def __init__(self, timeout: Optional[float] = None):
Initialize the KlavisToolkit with API client. The API key is
retrieved from environment variables.
_request
def _request(
self,
method: str,
endpoint: str,
payload: Optional[Dict[str, Any]] = None,
additional_headers: Optional[Dict[str, str]] = None
):
Make an HTTP request to the Klavis API.
Parameters:
- method (str): HTTP method (e.g., ‘GET’, ‘POST’, ‘DELETE’).
- endpoint (str): API endpoint path.
- payload (Optional[Dict[str, Any]]): JSON payload for POST requests.
- additional_headers (Optional[Dict[str, str]]): Additional headers to include in the request.
Returns:
Dict[str, Any]: The JSON response from the API or an error
dict.
create_server_instance
def create_server_instance(
self,
server_name: str,
user_id: str,
platform_name: str
):
Create a Server-Sent Events (SSE) URL for a specified MCP server.
Parameters:
- server_name (str): The name of the target MCP server.
- user_id (str): The ID for the user requesting the server URL.
- platform_name (str): The name of the platform associated with the user.
Returns:
Dict[str, Any]: Response containing the server instance details.
get_server_instance
def get_server_instance(self, instance_id: str):
Get details of a specific server connection instance.
Parameters:
- instance_id (str): The ID of the connection instance whose status is being checked.
Returns:
Dict[str, Any]: Details about the server instance.
delete_auth_data
def delete_auth_data(self, instance_id: str):
Delete authentication metadata for a specific server
connection instance.
Parameters:
- instance_id (str): The ID of the connection instance to delete auth for.
Returns:
Dict[str, Any]: Status response for the operation.
delete_server_instance
def delete_server_instance(self, instance_id: str):
Completely removes a server connection instance.
Parameters:
- instance_id (str): The ID of the connection instance to delete.
Returns:
Dict[str, Any]: Status response for the operation.
get_all_servers
def get_all_servers(self):
Returns:
Dict[str, Any]: Information about all available MCP servers.
set_auth_token
def set_auth_token(self, instance_id: str, auth_token: str):
Sets an authentication token for a specific instance.
Parameters:
- instance_id (str): The ID for the connection instance.
- auth_token (str): The authentication token to save.
Returns:
Dict[str, Any]: Status response for the operation.
def list_tools(self, server_url: str):
Lists all tools available for a specific remote MCP server.
Parameters:
- server_url (str): The full URL for connecting to the MCP server via Server-Sent Events (SSE).
Returns:
Dict[str, Any]: Response containing the list of tools or an error.
def call_tool(
self,
server_url: str,
tool_name: str,
tool_args: Optional[Dict[str, Any]] = None
):
Calls a remote MCP server tool directly using the provided server
URL.
Parameters:
- server_url (str): The full URL for connecting to the MCP server via Server-Sent Events (SSE).
- tool_name (str): The name of the tool to call.
- tool_args (Optional[Dict[str, Any]]): The input parameters for the tool. Defaults to None, which might be treated as empty args by the server. (default: :obj:
None)
Returns:
Dict[str, Any]: Response containing the result of the tool call
or an error.
Returns:
List[FunctionTool]: A list of FunctionTool objects representing
the functions in the toolkit.