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

import typing
from json.decoder import JSONDecodeError

from ....core.api_error import ApiError
from ....core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ....core.http_response import AsyncHttpResponse, HttpResponse
from ....core.jsonable_encoder import jsonable_encoder
from ....core.request_options import RequestOptions
from ....core.serialization import convert_and_respect_annotation_metadata
from ....core.unchecked_base_model import construct_type
from ....errors.conflict_error import ConflictError
from ....errors.not_found_error import NotFoundError
from ....errors.unprocessable_entity_error import UnprocessableEntityError
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 .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 RawToolConfigsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._client_wrapper = client_wrapper

    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,
    ) -> HttpResponse[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
        -------
        HttpResponse[McpServerResponseModel]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs",
            method="POST",
            json={
                "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": convert_and_respect_annotation_metadata(
                    object_=assignments, annotation=typing.Sequence[DynamicVariableAssignment], direction="write"
                ),
                "input_overrides": convert_and_respect_annotation_metadata(
                    object_=input_overrides,
                    annotation=typing.Dict[
                        str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]
                    ],
                    direction="write",
                ),
                "response_mocks": convert_and_respect_annotation_metadata(
                    object_=response_mocks, annotation=typing.Sequence[ToolResponseMockConfigInput], direction="write"
                ),
                "tool_name": tool_name,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    McpServerResponseModel,
                    construct_type(
                        type_=McpServerResponseModel,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 409:
                raise ConflictError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def get(
        self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[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
        -------
        HttpResponse[McpToolConfigOverrideOutput]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs/{jsonable_encoder(tool_name)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    McpToolConfigOverrideOutput,
                    construct_type(
                        type_=McpToolConfigOverrideOutput,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    def delete(
        self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> HttpResponse[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
        -------
        HttpResponse[McpServerResponseModel]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs/{jsonable_encoder(tool_name)}",
            method="DELETE",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    McpServerResponseModel,
                    construct_type(
                        type_=McpServerResponseModel,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    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,
    ) -> HttpResponse[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
        -------
        HttpResponse[McpServerResponseModel]
            Successful Response
        """
        _response = self._client_wrapper.httpx_client.request(
            f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs/{jsonable_encoder(tool_name)}",
            method="PATCH",
            json={
                "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": convert_and_respect_annotation_metadata(
                    object_=assignments, annotation=typing.Sequence[DynamicVariableAssignment], direction="write"
                ),
                "input_overrides": convert_and_respect_annotation_metadata(
                    object_=input_overrides,
                    annotation=typing.Dict[
                        str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]
                    ],
                    direction="write",
                ),
                "response_mocks": convert_and_respect_annotation_metadata(
                    object_=response_mocks, annotation=typing.Sequence[ToolResponseMockConfigInput], direction="write"
                ),
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    McpServerResponseModel,
                    construct_type(
                        type_=McpServerResponseModel,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return HttpResponse(response=_response, data=_data)
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)


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

    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,
    ) -> AsyncHttpResponse[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
        -------
        AsyncHttpResponse[McpServerResponseModel]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs",
            method="POST",
            json={
                "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": convert_and_respect_annotation_metadata(
                    object_=assignments, annotation=typing.Sequence[DynamicVariableAssignment], direction="write"
                ),
                "input_overrides": convert_and_respect_annotation_metadata(
                    object_=input_overrides,
                    annotation=typing.Dict[
                        str, typing.Optional[McpToolConfigOverrideCreateRequestModelInputOverridesValue]
                    ],
                    direction="write",
                ),
                "response_mocks": convert_and_respect_annotation_metadata(
                    object_=response_mocks, annotation=typing.Sequence[ToolResponseMockConfigInput], direction="write"
                ),
                "tool_name": tool_name,
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    McpServerResponseModel,
                    construct_type(
                        type_=McpServerResponseModel,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 409:
                raise ConflictError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def get(
        self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[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
        -------
        AsyncHttpResponse[McpToolConfigOverrideOutput]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs/{jsonable_encoder(tool_name)}",
            method="GET",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    McpToolConfigOverrideOutput,
                    construct_type(
                        type_=McpToolConfigOverrideOutput,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    async def delete(
        self, mcp_server_id: str, tool_name: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> AsyncHttpResponse[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
        -------
        AsyncHttpResponse[McpServerResponseModel]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs/{jsonable_encoder(tool_name)}",
            method="DELETE",
            request_options=request_options,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    McpServerResponseModel,
                    construct_type(
                        type_=McpServerResponseModel,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

    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,
    ) -> AsyncHttpResponse[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
        -------
        AsyncHttpResponse[McpServerResponseModel]
            Successful Response
        """
        _response = await self._client_wrapper.httpx_client.request(
            f"v1/convai/mcp-servers/{jsonable_encoder(mcp_server_id)}/tool-configs/{jsonable_encoder(tool_name)}",
            method="PATCH",
            json={
                "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": convert_and_respect_annotation_metadata(
                    object_=assignments, annotation=typing.Sequence[DynamicVariableAssignment], direction="write"
                ),
                "input_overrides": convert_and_respect_annotation_metadata(
                    object_=input_overrides,
                    annotation=typing.Dict[
                        str, typing.Optional[McpToolConfigOverrideUpdateRequestModelInputOverridesValue]
                    ],
                    direction="write",
                ),
                "response_mocks": convert_and_respect_annotation_metadata(
                    object_=response_mocks, annotation=typing.Sequence[ToolResponseMockConfigInput], direction="write"
                ),
            },
            headers={
                "content-type": "application/json",
            },
            request_options=request_options,
            omit=OMIT,
        )
        try:
            if 200 <= _response.status_code < 300:
                _data = typing.cast(
                    McpServerResponseModel,
                    construct_type(
                        type_=McpServerResponseModel,  # type: ignore
                        object_=_response.json(),
                    ),
                )
                return AsyncHttpResponse(response=_response, data=_data)
            if _response.status_code == 404:
                raise NotFoundError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            if _response.status_code == 422:
                raise UnprocessableEntityError(
                    headers=dict(_response.headers),
                    body=typing.cast(
                        typing.Any,
                        construct_type(
                            type_=typing.Any,  # type: ignore
                            object_=_response.json(),
                        ),
                    ),
                )
            _response_json = _response.json()
        except JSONDecodeError:
            raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
        raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
