Skip to content

Latest commit

 

History

History
372 lines (248 loc) · 27.7 KB

File metadata and controls

372 lines (248 loc) · 27.7 KB

Beta.Connectors

Overview

(beta) Connectors API - manage your connectors

Available Operations

create

Create a new MCP connector. You can customize its visibility, url and auth type.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.connectors.create(name="<value>", description="unibody usually despite slushy wherever reward stingy from", server="https://royal-majority.net/")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
name str ✔️ The name of the connector. Should be 64 char length maximum, alphanumeric, only underscores/dashes.
description str ✔️ The description of the connector.
server str ✔️ The url of the MCP server.
icon_url OptionalNullable[str] The optional url of the icon you want to associate to the connector.
visibility Optional[models.ResourceVisibility] N/A
headers Dict[str, Any] Optional organization-level headers to be sent with the request to the mcp server.
auth_data OptionalNullable[models.AuthData] Optional additional authentication data for the connector.
system_prompt OptionalNullable[str] Optional system prompt for the connector.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.Connector

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

list

List all your custom connectors with keyset pagination and filters.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.connectors.list(page_size=100)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
query_filters Optional[models.ConnectorsQueryFilters] N/A
cursor OptionalNullable[str] N/A
page_size Optional[int] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.PaginatedConnectors

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

get_auth_url

Get the OAuth2 authorization URL for a connector to initiate user authentication.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.connectors.get_auth_url(connector_id_or_name="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connector_id_or_name str ✔️ N/A
app_return_url OptionalNullable[str] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.AuthURLResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

call_tool

Call a tool on an MCP connector.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.connectors.call_tool(tool_name="<value>", connector_id_or_name="<value>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
tool_name str ✔️ N/A
connector_id_or_name str ✔️ N/A
credentials_name OptionalNullable[str] N/A
arguments Dict[str, Any] N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ConnectorToolCallResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

list_tools

List all tools available for an MCP connector.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.connectors.list_tools(connector_id_or_name="<value>", page=1, page_size=100, refresh=False, pretty=False)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connector_id_or_name str ✔️ N/A
page Optional[int] N/A
page_size Optional[int] N/A
refresh Optional[bool] N/A
pretty Optional[bool] Return a simplified payload with only name, description, annotations, and a compact inputSchema.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.ResponseConnectorListToolsV1

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

get

Get a connector by its ID or name.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.connectors.get(connector_id_or_name="<value>", fetch_customer_data=False, fetch_connection_secrets=False)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connector_id_or_name str ✔️ N/A
fetch_customer_data Optional[bool] Fetch the customer data associated with the connector (e.g. customer secrets / config).
fetch_connection_secrets Optional[bool] Fetch the general connection secrets associated with the connector.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.Connector

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

update

Update a connector by its ID.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.connectors.update(connector_id="81d30634-113f-4dce-a89e-7786be2d8693")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connector_id str ✔️ N/A
name OptionalNullable[str] The name of the connector.
description OptionalNullable[str] The description of the connector.
icon_url OptionalNullable[str] The optional url of the icon you want to associate to the connector.
system_prompt OptionalNullable[str] Optional system prompt for the connector.
connection_config Dict[str, Any] Optional new connection config.
connection_secrets Dict[str, Any] Optional new connection secrets
server OptionalNullable[str] New server url for your mcp connector.
headers Dict[str, Any] New headers for your mcp connector.
auth_data OptionalNullable[models.AuthData] New authentication data for your mcp connector.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.Connector

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*

delete

Delete a connector by its ID.

Example Usage

from mistralai.client import Mistral
import os


with Mistral(
    api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:

    res = mistral.beta.connectors.delete(connector_id="5c3269fe-6a18-4216-b1fb-b093005874cd")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
connector_id str ✔️ N/A
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.MessageResponse

Errors

Error Type Status Code Content Type
errors.HTTPValidationError 422 application/json
errors.SDKError 4XX, 5XX */*