# This file was auto-generated by Fern from our API Definition.

import typing

from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ....core.request_options import RequestOptions
from ....types.dynamic_variable_assignment import DynamicVariableAssignment
from ....types.mcp_server_response_model import McpServerResponseModel
from ....types.mcp_tool_config_override_output import McpToolConfigOverrideOutput
from ....types.pre_tool_speech_mode import PreToolSpeechMode
from ....types.tool_call_sound_behavior import ToolCallSoundBehavior
from ....types.tool_call_sound_type import ToolCallSoundType
from ....types.tool_execution_mode import ToolExecutionMode
from ....types.tool_response_mock_config_input import ToolResponseMockConfigInput
from .raw_client import AsyncRawToolConfigsClient, RawToolConfigsClient
from .types.mcp_tool_config_override_create_request_model_input_overrides_value import (
    McpToolConfigOverrideCreateRequestModelInputOverridesValue,
)
from .types.mcp_tool_config_override_update_request_model_input_overrides_value import (
    McpToolConfigOverrideUpdateRequestModelInputOverridesValue,
)

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class ToolConfigsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawToolConfigsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawToolConfigsClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawToolConfigsClient
        """
        return self._raw_client

    def create(
        self,
        mcp_server_id: str,
        *,
        tool_name: str,
        force_pre_tool_speech: typing.Optional[bool] = OMIT,
        pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT,
        disable_interruptions: typing.Optional[bool] = OMIT,
        tool_call_sound: typing.Optional[ToolCallSoundType] = OMIT,
        tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT,
        execution_mode: typing.Optional[ToolExecutionMode] = OMIT,
        response_timeout_secs: typing.Optional[int] = OMIT,
        assignments: typing.Optional[typing.Sequence[DynamicVariableAssignment]] = OMIT,
        input_overrides: typing.Optional[
            typing.Dict[str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]]
        ] = OMIT,
        response_mocks: typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> McpServerResponseModel:
        """
        Create configuration overrides for a specific MCP tool.

        Parameters
        ----------
        mcp_server_id : str
            ID of the MCP Server.

        tool_name : str
            The name of the MCP tool

        force_pre_tool_speech : typing.Optional[bool]
            DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool.

        pre_tool_speech : typing.Optional[PreToolSpeechMode]
            If set, overrides the server's pre_tool_speech setting for this tool.

        disable_interruptions : typing.Optional[bool]
            If set, overrides the server's disable_interruptions setting for this tool

        tool_call_sound : typing.Optional[ToolCallSoundType]
            If set, overrides the server's tool_call_sound setting for this tool

        tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior]
            If set, overrides the server's tool_call_sound_behavior setting for this tool

        execution_mode : typing.Optional[ToolExecutionMode]
            If set, overrides the server's execution_mode setting for this tool

        response_timeout_secs : typing.Optional[int]
            If set, overrides the server's response timeout for this MCP tool.

        assignments : typing.Optional[typing.Sequence[DynamicVariableAssignment]]
            Dynamic variable assignments for this MCP tool

        input_overrides : typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]]]
            Mapping of json path to input override configuration

        response_mocks : typing.Optional[typing.Sequence[ToolResponseMockConfigInput]]
            Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        McpServerResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.mcp_servers.tool_configs.create(
            mcp_server_id="mcp_server_id",
            tool_name="tool_name",
        )
        """
        _response = self._raw_client.create(
            mcp_server_id,
            tool_name=tool_name,
            force_pre_tool_speech=force_pre_tool_speech,
            pre_tool_speech=pre_tool_speech,
            disable_interruptions=disable_interruptions,
            tool_call_sound=tool_call_sound,
            tool_call_sound_behavior=tool_call_sound_behavior,
            execution_mode=execution_mode,
            response_timeout_secs=response_timeout_secs,
            assignments=assignments,
            input_overrides=input_overrides,
            response_mocks=response_mocks,
            request_options=request_options,
        )
        return _response.data

    def get(
        self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> McpToolConfigOverrideOutput:
        """
        Retrieve configuration overrides for a specific MCP tool.

        Parameters
        ----------
        mcp_server_id : str
            ID of the MCP Server.

        tool_name : str
            Name of the MCP tool to retrieve config overrides for.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        McpToolConfigOverrideOutput
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.mcp_servers.tool_configs.get(
            mcp_server_id="mcp_server_id",
            tool_name="tool_name",
        )
        """
        _response = self._raw_client.get(mcp_server_id, tool_name, request_options=request_options)
        return _response.data

    def delete(
        self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> McpServerResponseModel:
        """
        Remove configuration overrides for a specific MCP tool.

        Parameters
        ----------
        mcp_server_id : str
            ID of the MCP Server.

        tool_name : str
            Name of the MCP tool to remove config overrides for.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        McpServerResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.mcp_servers.tool_configs.delete(
            mcp_server_id="mcp_server_id",
            tool_name="tool_name",
        )
        """
        _response = self._raw_client.delete(mcp_server_id, tool_name, request_options=request_options)
        return _response.data

    def update(
        self,
        mcp_server_id: str,
        tool_name: str,
        *,
        force_pre_tool_speech: typing.Optional[bool] = OMIT,
        pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT,
        disable_interruptions: typing.Optional[bool] = OMIT,
        tool_call_sound: typing.Optional[ToolCallSoundType] = OMIT,
        tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT,
        execution_mode: typing.Optional[ToolExecutionMode] = OMIT,
        response_timeout_secs: typing.Optional[int] = OMIT,
        assignments: typing.Optional[typing.Sequence[DynamicVariableAssignment]] = OMIT,
        input_overrides: typing.Optional[
            typing.Dict[str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]]
        ] = OMIT,
        response_mocks: typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> McpServerResponseModel:
        """
        Update configuration overrides for a specific MCP tool.

        Parameters
        ----------
        mcp_server_id : str
            ID of the MCP Server.

        tool_name : str
            Name of the MCP tool to update config overrides for.

        force_pre_tool_speech : typing.Optional[bool]
            DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool.

        pre_tool_speech : typing.Optional[PreToolSpeechMode]
            If set, overrides the server's pre_tool_speech setting for this tool.

        disable_interruptions : typing.Optional[bool]
            If set, overrides the server's disable_interruptions setting for this tool

        tool_call_sound : typing.Optional[ToolCallSoundType]
            If set, overrides the server's tool_call_sound setting for this tool

        tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior]
            If set, overrides the server's tool_call_sound_behavior setting for this tool

        execution_mode : typing.Optional[ToolExecutionMode]
            If set, overrides the server's execution_mode setting for this tool

        response_timeout_secs : typing.Optional[int]
            If set, overrides the server's response timeout for this MCP tool.

        assignments : typing.Optional[typing.Sequence[DynamicVariableAssignment]]
            Dynamic variable assignments for this MCP tool

        input_overrides : typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]]]
            Mapping of json path to input override configuration

        response_mocks : typing.Optional[typing.Sequence[ToolResponseMockConfigInput]]
            Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        McpServerResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.mcp_servers.tool_configs.update(
            mcp_server_id="mcp_server_id",
            tool_name="tool_name",
        )
        """
        _response = self._raw_client.update(
            mcp_server_id,
            tool_name,
            force_pre_tool_speech=force_pre_tool_speech,
            pre_tool_speech=pre_tool_speech,
            disable_interruptions=disable_interruptions,
            tool_call_sound=tool_call_sound,
            tool_call_sound_behavior=tool_call_sound_behavior,
            execution_mode=execution_mode,
            response_timeout_secs=response_timeout_secs,
            assignments=assignments,
            input_overrides=input_overrides,
            response_mocks=response_mocks,
            request_options=request_options,
        )
        return _response.data


class AsyncToolConfigsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawToolConfigsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawToolConfigsClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawToolConfigsClient
        """
        return self._raw_client

    async def create(
        self,
        mcp_server_id: str,
        *,
        tool_name: str,
        force_pre_tool_speech: typing.Optional[bool] = OMIT,
        pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT,
        disable_interruptions: typing.Optional[bool] = OMIT,
        tool_call_sound: typing.Optional[ToolCallSoundType] = OMIT,
        tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT,
        execution_mode: typing.Optional[ToolExecutionMode] = OMIT,
        response_timeout_secs: typing.Optional[int] = OMIT,
        assignments: typing.Optional[typing.Sequence[DynamicVariableAssignment]] = OMIT,
        input_overrides: typing.Optional[
            typing.Dict[str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]]
        ] = OMIT,
        response_mocks: typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> McpServerResponseModel:
        """
        Create configuration overrides for a specific MCP tool.

        Parameters
        ----------
        mcp_server_id : str
            ID of the MCP Server.

        tool_name : str
            The name of the MCP tool

        force_pre_tool_speech : typing.Optional[bool]
            DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool.

        pre_tool_speech : typing.Optional[PreToolSpeechMode]
            If set, overrides the server's pre_tool_speech setting for this tool.

        disable_interruptions : typing.Optional[bool]
            If set, overrides the server's disable_interruptions setting for this tool

        tool_call_sound : typing.Optional[ToolCallSoundType]
            If set, overrides the server's tool_call_sound setting for this tool

        tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior]
            If set, overrides the server's tool_call_sound_behavior setting for this tool

        execution_mode : typing.Optional[ToolExecutionMode]
            If set, overrides the server's execution_mode setting for this tool

        response_timeout_secs : typing.Optional[int]
            If set, overrides the server's response timeout for this MCP tool.

        assignments : typing.Optional[typing.Sequence[DynamicVariableAssignment]]
            Dynamic variable assignments for this MCP tool

        input_overrides : typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]]]
            Mapping of json path to input override configuration

        response_mocks : typing.Optional[typing.Sequence[ToolResponseMockConfigInput]]
            Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        McpServerResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.mcp_servers.tool_configs.create(
                mcp_server_id="mcp_server_id",
                tool_name="tool_name",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.create(
            mcp_server_id,
            tool_name=tool_name,
            force_pre_tool_speech=force_pre_tool_speech,
            pre_tool_speech=pre_tool_speech,
            disable_interruptions=disable_interruptions,
            tool_call_sound=tool_call_sound,
            tool_call_sound_behavior=tool_call_sound_behavior,
            execution_mode=execution_mode,
            response_timeout_secs=response_timeout_secs,
            assignments=assignments,
            input_overrides=input_overrides,
            response_mocks=response_mocks,
            request_options=request_options,
        )
        return _response.data

    async def get(
        self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> McpToolConfigOverrideOutput:
        """
        Retrieve configuration overrides for a specific MCP tool.

        Parameters
        ----------
        mcp_server_id : str
            ID of the MCP Server.

        tool_name : str
            Name of the MCP tool to retrieve config overrides for.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        McpToolConfigOverrideOutput
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.mcp_servers.tool_configs.get(
                mcp_server_id="mcp_server_id",
                tool_name="tool_name",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get(mcp_server_id, tool_name, request_options=request_options)
        return _response.data

    async def delete(
        self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> McpServerResponseModel:
        """
        Remove configuration overrides for a specific MCP tool.

        Parameters
        ----------
        mcp_server_id : str
            ID of the MCP Server.

        tool_name : str
            Name of the MCP tool to remove config overrides for.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        McpServerResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.mcp_servers.tool_configs.delete(
                mcp_server_id="mcp_server_id",
                tool_name="tool_name",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.delete(mcp_server_id, tool_name, request_options=request_options)
        return _response.data

    async def update(
        self,
        mcp_server_id: str,
        tool_name: str,
        *,
        force_pre_tool_speech: typing.Optional[bool] = OMIT,
        pre_tool_speech: typing.Optional[PreToolSpeechMode] = OMIT,
        disable_interruptions: typing.Optional[bool] = OMIT,
        tool_call_sound: typing.Optional[ToolCallSoundType] = OMIT,
        tool_call_sound_behavior: typing.Optional[ToolCallSoundBehavior] = OMIT,
        execution_mode: typing.Optional[ToolExecutionMode] = OMIT,
        response_timeout_secs: typing.Optional[int] = OMIT,
        assignments: typing.Optional[typing.Sequence[DynamicVariableAssignment]] = OMIT,
        input_overrides: typing.Optional[
            typing.Dict[str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]]
        ] = OMIT,
        response_mocks: typing.Optional[typing.Sequence[ToolResponseMockConfigInput]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> McpServerResponseModel:
        """
        Update configuration overrides for a specific MCP tool.

        Parameters
        ----------
        mcp_server_id : str
            ID of the MCP Server.

        tool_name : str
            Name of the MCP tool to update config overrides for.

        force_pre_tool_speech : typing.Optional[bool]
            DEPRECATED: use `pre_tool_speech` instead. If set, overrides the server's force_pre_tool_speech setting for this tool.

        pre_tool_speech : typing.Optional[PreToolSpeechMode]
            If set, overrides the server's pre_tool_speech setting for this tool.

        disable_interruptions : typing.Optional[bool]
            If set, overrides the server's disable_interruptions setting for this tool

        tool_call_sound : typing.Optional[ToolCallSoundType]
            If set, overrides the server's tool_call_sound setting for this tool

        tool_call_sound_behavior : typing.Optional[ToolCallSoundBehavior]
            If set, overrides the server's tool_call_sound_behavior setting for this tool

        execution_mode : typing.Optional[ToolExecutionMode]
            If set, overrides the server's execution_mode setting for this tool

        response_timeout_secs : typing.Optional[int]
            If set, overrides the server's response timeout for this MCP tool.

        assignments : typing.Optional[typing.Sequence[DynamicVariableAssignment]]
            Dynamic variable assignments for this MCP tool

        input_overrides : typing.Optional[typing.Dict[str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]]]
            Mapping of json path to input override configuration

        response_mocks : typing.Optional[typing.Sequence[ToolResponseMockConfigInput]]
            Mock responses with optional parameter conditions. Evaluated top-to-bottom; first match wins.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        McpServerResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.mcp_servers.tool_configs.update(
                mcp_server_id="mcp_server_id",
                tool_name="tool_name",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update(
            mcp_server_id,
            tool_name,
            force_pre_tool_speech=force_pre_tool_speech,
            pre_tool_speech=pre_tool_speech,
            disable_interruptions=disable_interruptions,
            tool_call_sound=tool_call_sound,
            tool_call_sound_behavior=tool_call_sound_behavior,
            execution_mode=execution_mode,
            response_timeout_secs=response_timeout_secs,
            assignments=assignments,
            input_overrides=input_overrides,
            response_mocks=response_mocks,
            request_options=request_options,
        )
        return _response.data
