"""Arcade Starter Tools for Stripe

DO NOT EDIT THIS MODULE DIRECTLY.

THIS MODULE WAS AUTO-GENERATED BY TRANSPILING THE API WRAPPER TOOL JSON DEFINITIONS
IN THE ../wrapper_tools DIRECTORY INTO PYTHON CODE. ANY CHANGES TO THIS MODULE WILL
BE OVERWRITTEN BY THE TRANSPILER.
"""

from typing import Annotated, Any

import httpx
from arcade_tdk import ToolContext, tool


def remove_none_values(data: dict[str, Any]) -> dict[str, Any]:
    return {k: v for k, v in data.items() if v is not None}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_stripe_account_details(
    context: ToolContext,
    expand_fields: Annotated[
        list[str] | None,
        "A list of fields to specify which fields in the Stripe account response should be expanded.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetAccount'."]:
    """Retrieve details of a Stripe account.

    Use this tool to get information about a specific Stripe account, such as its status and settings."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/account",
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_stripe_connected_account(
    context: ToolContext,
    account_id_to_delete: Annotated[
        str,
        "The unique identifier of the Stripe account to be deleted. Ensure this is a managed account with zero balance.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteAccountsAccount'."]:
    """Delete managed accounts via Stripe Connect.

    Use this tool to delete accounts you manage through Stripe Connect. Suitable for test-mode accounts anytime and live-mode accounts except those with standard dashboard access or negative balances. Ensure all balances are zero before deletion."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/accounts/{account}".format(account=account_id_to_delete),  # noqa: UP032
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_account_details(
    context: ToolContext,
    account_id: Annotated[str, "The unique identifier of the account to retrieve details for."],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields to expand in the response for detailed account information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetAccountsAccount'."]:
    """Retrieve details of a specific account.

    Use this tool to obtain detailed information about a specific account using its identifier."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/accounts/{account}".format(account=account_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_external_bank_account(
    context: ToolContext,
    account_identifier: Annotated[
        str, "The account ID from which you want to delete an external bank account."
    ],
    external_account_id: Annotated[
        str, "The unique identifier of the external bank account to be deleted."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'DeleteAccountsAccountBankAccountsId'."
]:
    """Delete an external bank account for a specified account.

    Use this tool to remove a specified external bank account from a given account. It confirms the successful deletion."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/accounts/{account}/bank_accounts/{id}".format(  # noqa: UP032
                account=account_identifier, id=external_account_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_external_bank_account_details(
    context: ToolContext,
    account_id: Annotated[
        str, "The unique identifier for the account associated with the external bank account."
    ],
    external_account_id: Annotated[
        str, "Unique identifier for the external bank account to retrieve its details."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to expand for additional detail."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetAccountsAccountBankAccountsId'."
]:
    """Retrieve details of a specific external bank account for an account.

    Use this tool to obtain details of a specified external bank account associated with a given account using its ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/accounts/{account}/bank_accounts/{id}".format(  # noqa: UP032
                account=account_id, id=external_account_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_account_capabilities(
    context: ToolContext,
    account_id: Annotated[
        str,
        "The ID of the Stripe account for which to retrieve capabilities. This is a required field.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None, "A list of fields to expand in the response, specified as strings."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetAccountsAccountCapabilities'."]:
    """Retrieve capabilities associated with a Stripe account.

    This tool returns a list of capabilities for a specified Stripe account, sorted by their creation date."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/accounts/{account}/capabilities".format(  # noqa: UP032
                account=account_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_account_capability_details(
    context: ToolContext,
    account_id: Annotated[
        str,
        "The unique identifier for the Stripe account whose capability information is being requested.",  # noqa: E501
    ],
    account_capability_identifier: Annotated[
        str,
        "A unique identifier string for the specific capability of the account to be retrieved. This is essential to specify which capability's details you want to fetch from Stripe.",  # noqa: E501
    ],
    expand_fields: Annotated[
        list[str] | None, "List of fields in the response to expand for detailed information."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetAccountsAccountCapabilitiesCapability'."
]:
    """Retrieve details of a specific account capability.

    This tool fetches information about a specific capability of an account in Stripe. It should be called when there's a need to understand the capabilities available on an account."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/accounts/{account}/capabilities/{capability}".format(  # noqa: UP032
                account=account_id, capability=account_capability_identifier
            ),
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def list_external_accounts(
    context: ToolContext,
    stripe_account_id: Annotated[
        str,
        "The unique identifier for the Stripe account whose external accounts you want to retrieve.",  # noqa: E501
    ],
    pagination_ending_before: Annotated[
        str | None,
        "A cursor used to define your position in the list for pagination. It specifies the object ID before which the list should end.",  # noqa: E501
    ] = None,
    expand_response_fields: Annotated[
        list[str] | None, "A list of fields in the response to expand for detailed information."
    ] = None,
    max_results_per_page: Annotated[
        int | None,
        "Specify the number of external accounts to retrieve, ranging from 1 to 100. Default is 10.",  # noqa: E501
    ] = None,
    filter_by_object_type: Annotated[
        str | None, "Specify the type of external accounts to filter: 'bank_account' or 'card'."
    ] = None,
    pagination_starting_after_object_id: Annotated[
        str | None,
        "Object ID for pagination to fetch the next page of results. Use the ID of the last object from the current list.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetAccountsAccountExternalAccounts'."
]:
    """Retrieve external accounts linked to a Stripe account.

    This tool retrieves the external accounts associated with a specified Stripe account. It should be called when you need details about the financial accounts linked to a specific Stripe account ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/accounts/{account}/external_accounts".format(  # noqa: UP032
                account=stripe_account_id
            ),
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": expand_response_fields,
                "limit": max_results_per_page,
                "object": filter_by_object_type,
                "starting_after": pagination_starting_after_object_id,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_external_account(
    context: ToolContext,
    account_identifier: Annotated[
        str, "The unique identifier of the account from which the external account will be deleted."
    ],
    external_account_id: Annotated[
        str, "Unique identifier for the external account to be deleted."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'DeleteAccountsAccountExternalAccountsId'."
]:
    """Delete a specified external account for a given account.

    Use this tool to delete an external account linked to a specific account. Ideal for managing external accounts by removing unwanted or outdated entries."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/accounts/{account}/external_accounts/{id}".format(  # noqa: UP032
                account=account_identifier, id=external_account_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_stripe_external_account_details(
    context: ToolContext,
    stripe_account_id: Annotated[
        str, "The unique identifier for the Stripe account containing the external account."
    ],
    external_account_id: Annotated[
        str, "Unique identifier for the external account to be retrieved from Stripe."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields to expand in the response for additional details."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetAccountsAccountExternalAccountsId'."
]:
    """Retrieve details of a specific Stripe external account.

    This tool fetches information about a specified external account for a given Stripe account. It should be used to obtain details about linked bank accounts or cards associated with a Stripe account."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/accounts/{account}/external_accounts/{id}".format(  # noqa: UP032
                account=stripe_account_id, id=external_account_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_account_person_relationship(
    context: ToolContext,
    account_id: Annotated[
        str,
        "The unique identifier for the Stripe account from which the person's relationship will be removed. This ID is required to specify the correct account.",  # noqa: E501
    ],
    person_id: Annotated[
        str,
        "The unique identifier of the person whose relationship to the account is to be removed.",
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'DeleteAccountsAccountPeoplePerson'."
]:
    """Remove a person's relationship from a Stripe account.

    This tool deletes an existing person's relationship to a Stripe account's legal entity. It cannot delete the account opener or the only verified executive, if applicable."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/accounts/{account}/people/{person}".format(  # noqa: UP032
                account=account_id, person=person_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_person_information(
    context: ToolContext,
    stripe_account_id: Annotated[
        str,
        "The unique identifier of the Stripe account from which to retrieve the person's information. This is required to access the account details linked to this person.",  # noqa: E501
    ],
    person_identifier: Annotated[
        str,
        "The unique identifier of the person to retrieve within the Stripe account. This ID is required to fetch the specific person's details.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetAccountsAccountPeoplePerson'."]:
    """Retrieve information about a person in a Stripe account.

    Use this tool to obtain details of a specific person associated with a Stripe account. Ideal for scenarios where user requests involve checking or verifying personal information linked to an account."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/accounts/{account}/people/{person}".format(  # noqa: UP032
                account=stripe_account_id, person=person_identifier
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_account_person(
    context: ToolContext,
    account_id: Annotated[
        str,
        "The unique identifier of the account from which a person's relationship will be deleted. This must be a valid Stripe account ID.",  # noqa: E501
    ],
    person_id: Annotated[
        str,
        "A unique identifier for the person whose relationship to the account will be deleted. This is required and must be a valid person ID in Stripe.",  # noqa: E501
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'DeleteAccountsAccountPersonsPerson'."
]:
    """Delete a person's relationship to an account in Stripe.

    Deletes a person's relationship to the account's legal entity in Stripe, except for the account_opener or the sole verified executive."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/accounts/{account}/persons/{person}".format(  # noqa: UP032
                account=account_id, person=person_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_person_account_details(
    context: ToolContext,
    account_id: Annotated[
        str,
        "The identifier of the Stripe account to which the person is linked. This is required to specify which account's person details need to be retrieved.",  # noqa: E501
    ],
    person_identifier: Annotated[
        str,
        "The unique identifier of the person whose details need to be retrieved. This ID is associated with the person's account in Stripe.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response to be expanded for detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetAccountsAccountPersonsPerson'."]:
    """Retrieve details of a person linked to an account.

    This tool retrieves details of an existing person associated with a specified account in Stripe. It should be called when you need to fetch information about a specific person related to an account on the Stripe platform."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/accounts/{account}/persons/{person}".format(  # noqa: UP032
                account=account_id, person=person_identifier
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def list_apple_pay_domains(
    context: ToolContext,
    domain_name_filter: Annotated[
        str | None, "Filter the list by a specific domain name. Leave empty to return all domains."
    ] = None,
    pagination_ending_before_id: Annotated[
        str | None, "Object ID for pagination to fetch the previous page of the list."
    ] = None,
    expand_fields: Annotated[
        list[str] | None, "An array of fields to expand in the response for additional details."
    ] = None,
    max_domains_to_return: Annotated[
        int | None,
        "Specify the number of Apple Pay domains to retrieve, between 1 and 100. Defaults to 10 if not set.",  # noqa: E501
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None, "An object ID for pagination to retrieve the next page of the list."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetApplePayDomains'."]:
    """Retrieve a list of Apple Pay domains.

    Use this tool to get a list of all Apple Pay domains associated with your Stripe account."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/apple_pay/domains",
            params=remove_none_values({
                "domain_name": domain_name_filter,
                "ending_before": pagination_ending_before_id,
                "expand": expand_fields,
                "limit": max_domains_to_return,
                "starting_after": pagination_starting_after_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_apple_pay_domain(
    context: ToolContext,
    apple_pay_domain_to_delete: Annotated[
        str, "The domain name of the Apple Pay domain you wish to delete from your Stripe account."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteApplePayDomainsDomain'."]:
    """Delete an Apple Pay domain from Stripe.

    Use this tool to delete a specific Apple Pay domain registered with your Stripe account. This is useful for managing domains no longer required for Apple Pay services."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/apple_pay/domains/{domain}".format(  # noqa: UP032
                domain=apple_pay_domain_to_delete
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_apple_pay_domain(
    context: ToolContext,
    apple_pay_domain_name: Annotated[
        str,
        "The domain name of the Apple Pay site to retrieve details for. This should be a valid domain string.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None, "A list of fields to expand in the response for additional details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetApplePayDomainsDomain'."]:
    """Retrieve details of an Apple Pay domain.

    Use this tool to get information about a specific Apple Pay domain by providing the domain name."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/apple_pay/domains/{domain}".format(  # noqa: UP032
                domain=apple_pay_domain_name
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_application_fee_refund_detail(
    context: ToolContext,
    application_fee_id: Annotated[
        str, "The ID of the application fee associated with the refund to retrieve details for."
    ],
    refund_id: Annotated[
        str,
        "The unique identifier of the specific refund to retrieve details for. This is required to access a particular refund.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields to expand in the response for additional detail."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetApplicationFeesFeeRefundsId'."]:
    """Retrieve details of a specific application fee refund.

    Use this tool to obtain detailed information about a specific refund related to an application fee, beyond the 10 most recent refunds available by default."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/application_fees/{fee}/refunds/{id}".format(  # noqa: UP032
                fee=application_fee_id, id=refund_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_application_fee_details(
    context: ToolContext,
    application_fee_id: Annotated[
        str, "The unique identifier of the application fee to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "A list of fields to expand in the response for detailed information."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetApplicationFeesId'."]:
    """Retrieve details of a specific application fee.

    Use this tool to get information about an application fee collected by your account. It provides the same details as when refunding the fee."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/application_fees/{id}".format(id=application_fee_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_application_fee_refunds(
    context: ToolContext,
    application_fee_id: Annotated[
        str,
        "The unique identifier of the application fee for which refunds are being retrieved. This ID specifies which fee's refunds should be listed.",  # noqa: E501
    ],
    pagination_cursor_ending_before: Annotated[
        str | None, "An object ID cursor used for pagination to fetch the previous page of refunds."
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to expand for additional details."
    ] = None,
    maximum_number_of_refunds: Annotated[
        int | None,
        "The maximum number of refund objects to return, ranging from 1 to 100. Defaults to 10 if not specified.",  # noqa: E501
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "An object ID to fetch the next page of refunds after this ID, used for pagination.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetApplicationFeesIdRefunds'."]:
    """Retrieve refunds for a specific application fee.

    Use this tool to access more than the default 10 refunds associated with a specific application fee, using pagination parameters if needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/application_fees/{id}/refunds".format(  # noqa: UP032
                id=application_fee_id
            ),
            params=remove_none_values({
                "ending_before": pagination_cursor_ending_before,
                "expand": fields_to_expand,
                "limit": maximum_number_of_refunds,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_current_account_balance(
    context: ToolContext,
    fields_to_expand: Annotated[
        list[str] | None, "List of fields to expand in the response for additional details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetBalance'."]:
    """Retrieve the current account balance from Stripe.

    Use this tool to get the current account balance based on the authentication used. It's helpful for accessing up-to-date financial data from the Stripe account."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/balance",
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_balance_transaction_by_id(
    context: ToolContext,
    balance_transaction_id: Annotated[
        str, "The unique identifier for the balance transaction to retrieve."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetBalanceHistoryId'."]:
    """Retrieve details of a balance transaction by ID.

    Call this tool to get the details of a specific balance transaction using its ID. Useful for accessing historical balance changes for specific transactions."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/balance/history/{id}".format(id=balance_transaction_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_balance_settings(
    context: ToolContext,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for the connected Stripe account's balance settings.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetBalanceSettings'."]:
    """Retrieve balance settings for a connected Stripe account.

    Use this tool to obtain the balance settings associated with a specific connected account in Stripe. Useful for managing and reviewing account financial settings."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/balance_settings",
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_balance_transaction_by_id(
    context: ToolContext,
    transaction_id: Annotated[
        str, "The unique identifier of the balance transaction to be retrieved."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for additional details.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetBalanceTransactionsId'."]:
    """Retrieve details of a balance transaction by ID.

    Call this tool to get comprehensive information about a specific balance transaction using its ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/balance_transactions/{id}".format(id=transaction_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_billing_alerts(
    context: ToolContext,
    filter_by_alert_type: Annotated[
        str | None,
        "Filter results to only include alerts of the specified type. Accepts 'usage_threshold'.",
    ] = None,
    pagination_ending_before: Annotated[
        str | None,
        "A pagination cursor. Use this ID to fetch the previous page of the list if starting from a specific object.",  # noqa: E501
    ] = None,
    expand_response_fields: Annotated[
        list[str] | None,
        "List of fields in the response that should be expanded. Each field should be a string.",
    ] = None,
    result_limit: Annotated[
        int | None,
        "Specify the maximum number of billing alerts to be returned. Accepts an integer from 1 to 100. Defaults to 10 if not provided.",  # noqa: E501
    ] = None,
    filter_by_meter: Annotated[
        str | None, "Filter results to only include alerts related to a specific meter type."
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "Cursor indicating the starting point for fetching the next page of alerts. Use an object ID from a previous response.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetBillingAlerts'."]:
    """Retrieve active and inactive billing alerts.

    Use this tool to list all current billing alerts, both active and inactive, from Stripe."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/billing/alerts",
            params=remove_none_values({
                "alert_type": filter_by_alert_type,
                "ending_before": pagination_ending_before,
                "expand": expand_response_fields,
                "limit": result_limit,
                "meter": filter_by_meter,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_billing_alert(
    context: ToolContext,
    billing_alert_id: Annotated[
        str, "The unique identifier of the billing alert to retrieve details for."
    ],
    expand_fields: Annotated[
        list[str] | None, "List of fields in the response that should be expanded."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetBillingAlertsId'."]:
    """Retrieve billing alert details by ID.

    This tool retrieves billing alert information from Stripe using a specific alert ID. It should be called when you need details about a particular billing alert."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/billing/alerts/{id}".format(id=billing_alert_id),  # noqa: UP032
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_credit_balance_transactions(
    context: ToolContext,
    customer_id: Annotated[
        str, "The unique identifier of the customer for which to fetch credit balance transactions."
    ],
    credit_grant_id: Annotated[
        str | None,
        "The identifier for the specific credit grant to fetch its credit balance transactions.",
    ] = None,
    pagination_ending_cursor: Annotated[
        str | None,
        "A pagination cursor ID to fetch the previous page of the list. Use an object ID to identify your position.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response that should be expanded for additional details.",
    ] = None,
    max_transactions_to_return: Annotated[
        int | None,
        "Specify the maximum number of transactions to return, ranging between 1 and 100. The default is 10.",  # noqa: E501
    ] = None,
    pagination_starting_after: Annotated[
        str | None, "An object ID cursor to fetch the next page of credit balance transactions."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetBillingCreditBalanceTransactions'."
]:
    """Retrieve a list of credit balance transactions.

    This tool calls the Stripe API endpoint to fetch credit balance transactions. It should be used to review or analyze credit activity associated with billing accounts."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/billing/credit_balance_transactions",
            params=remove_none_values({
                "credit_grant": credit_grant_id,
                "customer": customer_id,
                "ending_before": pagination_ending_cursor,
                "expand": fields_to_expand,
                "limit": max_transactions_to_return,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_credit_balance_transaction(
    context: ToolContext,
    transaction_id: Annotated[
        str, "Unique identifier for the credit balance transaction to be retrieved."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "An array of field names to expand in the response. Allows accessing nested information related to the transaction.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetBillingCreditBalanceTransactionsId'."
]:
    """Retrieve a credit balance transaction by ID.

    Use this tool to obtain information about a specific credit balance transaction using its ID."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/billing/credit_balance_transactions/{id}".format(  # noqa: UP032
                id=transaction_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_billing_credit_grants(
    context: ToolContext,
    customer_id: Annotated[
        str | None,
        "The unique identifier of the customer whose credit grants you want to retrieve.",
    ] = None,
    pagination_ending_before: Annotated[
        str | None,
        "An object ID to fetch the previous page of the list. Use the last received object's ID from the current page.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields to be expanded in the response for detailed information.",
    ] = None,
    credit_grant_limit: Annotated[
        int | None,
        "The maximum number of credit grants to return, between 1 and 100. Defaults to 10 if not specified.",  # noqa: E501
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "A cursor (object ID) for pagination to fetch the next page in the list. Use the ID from the last object in the previous list.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetBillingCreditGrants'."]:
    """Retrieve a list of billing credit grants.

    Use this tool to retrieve information about billing credit grants from Stripe. It should be called when you need details about existing credit grants."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/billing/credit_grants",
            params=remove_none_values({
                "customer": customer_id,
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "limit": credit_grant_limit,
                "starting_after": pagination_starting_after_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_credit_grant(
    context: ToolContext,
    credit_grant_id: Annotated[
        str, "The unique identifier for the credit grant to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response that should be expanded to include additional details.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetBillingCreditGrantsId'."]:
    """Retrieve details of a specific credit grant using its ID.

    Call this tool to get information about a specific credit grant by providing its ID. Useful for checking credit grant details within billing systems."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/billing/credit_grants/{id}".format(id=credit_grant_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_billing_meters(
    context: ToolContext,
    pagination_ending_before: Annotated[
        str | None, "An object ID cursor to fetch the previous page, used for pagination."
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "An array of strings specifying which fields in the response should be expanded.",
    ] = None,
    number_of_billing_meters: Annotated[
        int | None,
        "Specify the number of billing meters to return, ranging from 1 to 100 (default is 10).",
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "Cursor ID to define your starting point in the list for pagination. Use this to fetch the next page of results.",  # noqa: E501
    ] = None,
    filter_status: Annotated[
        str | None,
        "Filter results to include only billing meters with the specified status. Options are 'active' or 'inactive'.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetBillingMeters'."]:
    """Retrieve a list of billing meters from Stripe."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/billing/meters",
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "limit": number_of_billing_meters,
                "starting_after": pagination_starting_after_cursor,
                "status": filter_status,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_billing_meter(
    context: ToolContext,
    billing_meter_id: Annotated[str, "The ID of the billing meter to be retrieved."],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of field names to expand in the billing meter response for additional details.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetBillingMetersId'."]:
    """Retrieve billing meter details by ID.

    Use this tool to get information about a billing meter by providing its ID."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/billing/meters/{id}".format(id=billing_meter_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_billing_meter_event_summaries(
    context: ToolContext,
    customer_id: Annotated[
        str, "The unique identifier of the customer for which to fetch event summaries."
    ],
    stop_aggregating_until: Annotated[
        int,
        "The exclusive timestamp to stop aggregating meter events. Ensure it aligns with minute boundaries.",  # noqa: E501
    ],
    start_time_timestamp: Annotated[
        int,
        "The timestamp to begin aggregating meter events (inclusive). Must align with minute boundaries.",  # noqa: E501
    ],
    meter_id: Annotated[
        str, "The unique identifier for the billing meter to fetch event summaries for."
    ],
    pagination_ending_before_id: Annotated[
        str | None,
        "An object ID for pagination, used to fetch the previous page of a list. Aligns the list cursor to end before the specified object ID.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for detailed results.",
    ] = None,
    number_of_objects_limit: Annotated[
        int | None,
        "A limit on the number of billing meter event summaries to be returned. Must be between 1 and 100, with a default of 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_id: Annotated[
        str | None,
        "The object ID to use as a cursor to fetch the next page of the list for pagination.",
    ] = None,
    granularity_for_event_summaries: Annotated[
        str | None,
        "Specifies the granularity for event summaries: 'hour' or 'day'. If not set, returns a single summary for the time range.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetBillingMetersIdEventSummaries'."
]:
    """Retrieve billing meter event summaries by meter ID.

    Call this tool to get a list of billing meter event summaries for a specific meter ID, providing insights into billing events and activities."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/billing/meters/{id}/event_summaries".format(id=meter_id),  # noqa: UP032
            params=remove_none_values({
                "customer": customer_id,
                "end_time": stop_aggregating_until,
                "ending_before": pagination_ending_before_id,
                "expand": fields_to_expand,
                "limit": number_of_objects_limit,
                "start_time": start_time_timestamp,
                "starting_after": pagination_starting_after_id,
                "value_grouping_window": granularity_for_event_summaries,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_billing_portal_configurations(
    context: ToolContext,
    pagination_cursor_ending_before: Annotated[
        str | None,
        "A cursor for pagination to get the previous page in the list, using an object ID.",
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response to be expanded. Each entry should be a string representing a field name.",  # noqa: E501
    ] = None,
    result_limit: Annotated[
        int | None,
        "Specify the number of configurations to return, between 1 and 100. Default is 10.",
    ] = None,
    pagination_start_after_id: Annotated[
        str | None, "A cursor object ID used to fetch the next page of the list for pagination."
    ] = None,
    only_active_configurations: Annotated[
        bool | None,
        "Set to true to list only active configurations, or false to list inactive ones.",
    ] = None,
    return_default_configurations_only: Annotated[
        bool | None,
        "Set to true to return only default configurations, or false to return non-default configurations.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetBillingPortalConfigurations'."]:
    """Retrieve customer portal configurations from Stripe.

    Provides configurations that describe the functionality of the billing customer portal. Useful for understanding available setups and settings for customer management."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/billing_portal/configurations",
            params=remove_none_values({
                "active": only_active_configurations,
                "ending_before": pagination_cursor_ending_before,
                "expand": fields_to_expand,
                "is_default": return_default_configurations_only,
                "limit": result_limit,
                "starting_after": pagination_start_after_id,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_portal_configuration(
    context: ToolContext,
    configuration_id: Annotated[
        str, "The unique identifier for the customer portal configuration to retrieve."
    ],
    expand_fields_in_response: Annotated[
        list[str] | None,
        "A list of field names in the response that should be expanded for more detailed information.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetBillingPortalConfigurationsConfiguration'."
]:
    """Retrieve customer portal configuration details.

    Fetches the configuration that outlines the functionality of the billing portal for a specific customer."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/billing_portal/configurations/{configuration}".format(  # noqa: UP032
                configuration=configuration_id
            ),
            params=remove_none_values({"expand": expand_fields_in_response}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def stripe_search_charges(
    context: ToolContext,
    search_query_string: Annotated[
        str,
        "The search query string using Stripe's Search Query Language to filter charge results. Refer to Stripe's documentation for syntax and fields.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for additional detail.",
    ] = None,
    result_limit: Annotated[
        int | None,
        "Specify the number of charge objects to return. The limit can be between 1 and 100, with a default of 10.",  # noqa: E501
    ] = None,
    pagination_cursor: Annotated[
        str | None,
        "Cursor for pagination. Use the 'next_page' value from the previous response for subsequent requests. Omit on the first call.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetChargesSearch'."]:
    """Search for previously created charges using Stripe.

    Use this tool to search for charges you've created with Stripe using their Search Query Language. It's not suitable for scenarios needing strict consistency. Data may take up to an hour to appear during outages, and the feature is unavailable in India."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/charges/search",
            params=remove_none_values({
                "expand": fields_to_expand,
                "limit": result_limit,
                "page": pagination_cursor,
                "query": search_query_string,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_stripe_charge_details(
    context: ToolContext,
    charge_id: Annotated[
        str, "The unique identifier of the charge. Use this to retrieve its details."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to expand for more detailed information."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetChargesCharge'."]:
    """Retrieve details of a specific Stripe charge via its unique ID.

    Use this tool to get details of a previously created charge on Stripe by providing the charge's unique ID. It returns information such as amount, currency, status, and more."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/charges/{charge}".format(charge=charge_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_charge_dispute_details(
    context: ToolContext,
    charge_id: Annotated[
        str, "The unique identifier of the charge for which you want to retrieve dispute details."
    ],
    fields_to_expand_in_dispute_response: Annotated[
        list[str] | None, "List of fields to expand in the dispute response for additional details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetChargesChargeDispute'."]:
    """Retrieve details of a dispute for a specific charge.

    Use this tool to fetch information about a dispute associated with a particular charge. This is helpful when you need to understand the dispute details for a specific transaction processed via Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/charges/{charge}/dispute".format(charge=charge_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand_in_dispute_response}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_charge_refunds(
    context: ToolContext,
    charge_id: Annotated[
        str,
        "The unique identifier of the charge for which to retrieve refunds. This ID is required to specify the particular charge.",  # noqa: E501
    ],
    pagination_ending_before: Annotated[
        str | None, "Specify an object ID to fetch the previous page of refunds before this object."
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None, "List of fields to expand in the response for more detailed information."
    ] = None,
    object_return_limit: Annotated[
        int | None,
        "Specify the number of refunds to return, ranging from 1 to 100. Defaults to 10 if not set.",  # noqa: E501
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "ID of the object to start retrieving the next page from. Used for pagination in refund lists.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetChargesChargeRefunds'."]:
    """Retrieve refunds for a specific charge on Stripe.

    This tool retrieves a list of refunds associated with a specific charge on Stripe. It provides access to more than the 10 most recent refunds by allowing pagination through the 'limit' and 'starting_after' parameters."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/charges/{charge}/refunds".format(charge=charge_id),  # noqa: UP032
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "limit": object_return_limit,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_refund_details_by_charge(
    context: ToolContext,
    charge_id: Annotated[str, "The unique identifier for the charge associated with the refund."],
    refund_id: Annotated[
        str,
        "The ID of the refund to retrieve details for. This is required to specify the refund you want to look up.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the refund details to be expanded in the response."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetChargesChargeRefundsRefund'."]:
    """Fetches details of a refund associated to a specific charge.

    Use this tool to get detailed information about a specific refund by providing the charge ID and refund ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/charges/{charge}/refunds/{refund}".format(  # noqa: UP032
                charge=charge_id, refund=refund_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_checkout_session(
    context: ToolContext,
    session_id: Annotated[
        str,
        "The unique identifier for the Checkout Session you want to retrieve. This is required to specify which session's details to access.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the checkout session response that should be expanded for more detailed information.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCheckoutSessionsSession'."]:
    """Retrieve a specific Stripe checkout session.

    This tool retrieves detailed information about a specific Checkout Session from Stripe. It should be called when there's a need to access the data for a particular session, identified by its session ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/checkout/sessions/{session}".format(session=session_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_checkout_session_line_items(
    context: ToolContext,
    checkout_session_id: Annotated[
        str,
        "The unique identifier for the Stripe Checkout Session. This ID is required to retrieve associated line items.",  # noqa: E501
    ],
    cursor_ending_before: Annotated[
        str | None,
        "An object ID used for pagination to retrieve the page before the specified object in the list.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for additional details.",
    ] = None,
    item_limit: Annotated[
        int | None,
        "Sets the maximum number of line items to return, ranging from 1 to 100. Default is 10.",
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "A string representing the object ID to start the list after, for pagination purposes.",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetCheckoutSessionsSessionLineItems'."
]:
    """Fetch line items from a Stripe Checkout Session.

    Use this tool to retrieve line items associated with a specific Stripe Checkout Session, including a paginated list if required."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/checkout/sessions/{session}/line_items".format(  # noqa: UP032
                session=checkout_session_id
            ),
            params=remove_none_values({
                "ending_before": cursor_ending_before,
                "expand": fields_to_expand,
                "limit": item_limit,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def list_climate_orders(
    context: ToolContext,
    pagination_ending_before_cursor: Annotated[
        str | None,
        "A cursor ID to paginate backwards through the list, fetching the page before the specified object ID for Climate orders.",  # noqa: E501
    ] = None,
    expand_fields: Annotated[
        list[str] | None,
        "A list of fields in the response to expand. Provide each field name as a string in an array.",  # noqa: E501
    ] = None,
    maximum_objects_to_return: Annotated[
        int | None,
        "The number of Climate order objects to retrieve, ranging from 1 to 100. Default is 10.",
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "An object ID used as a cursor to define your place in the pagination list to retrieve the next page.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetClimateOrders'."]:
    """Retrieve all Climate order objects from Stripe.

    The tool fetches and lists all Climate order objects from the Stripe service. These orders are sorted by creation date, with the most recent ones appearing first."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/climate/orders",
            params=remove_none_values({
                "ending_before": pagination_ending_before_cursor,
                "expand": expand_fields,
                "limit": maximum_objects_to_return,
                "starting_after": pagination_starting_after_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_climate_order_details(
    context: ToolContext,
    order_id: Annotated[str, "Unique identifier for the Climate order to retrieve details."],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for more detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetClimateOrdersOrder'."]:
    """Retrieve details of a specific Climate order.

    Use this tool to get information about a Climate order based on its ID."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/climate/orders/{order}".format(order=order_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def list_climate_products(
    context: ToolContext,
    pagination_ending_before: Annotated[
        str | None,
        "An object ID cursor to fetch the previous page in a paginated list. Use to define your place in the list.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "Specify which fields in the response should be expanded as a list of strings.",
    ] = None,
    objects_limit: Annotated[
        int | None,
        "The maximum number of Climate product objects to return, ranging from 1 to 100. Default is 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_id: Annotated[
        str | None,
        "A cursor (object ID) to define your starting point in the list for pagination. Used to fetch the next page after the specified object ID.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetClimateProducts'."]:
    """Retrieve a list of all available Climate products.

    Use this tool to get information about all available Climate product objects from the Stripe service."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/climate/products",
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "limit": objects_limit,
                "starting_after": pagination_starting_after_id,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_climate_product_details(
    context: ToolContext,
    product_id: Annotated[
        str, "The unique identifier of the Climate product to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to expand for additional details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetClimateProductsProduct'."]:
    """Retrieve details of a specific Climate product from Stripe.

    This tool retrieves the details of a Climate product using the provided product ID from Stripe's API."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/climate/products/{product}".format(product=product_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def list_climate_suppliers(
    context: ToolContext,
    pagination_ending_before: Annotated[
        str | None,
        "The object ID to use as a cursor for fetching the previous page of suppliers in the list.",
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response that should be expanded."
    ] = None,
    result_limit: Annotated[
        int | None,
        "Specify the number of Climate supplier objects to return, ranging from 1 to 100, with a default of 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None, "Object ID for pagination to fetch the next page of the Climate suppliers list."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetClimateSuppliers'."]:
    """Retrieve a list of all available Climate suppliers.

    This tool calls the Stripe API to list all available Climate supplier objects. It should be used when you need information about climate suppliers for Stripe-related services."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/climate/suppliers",
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "limit": result_limit,
                "starting_after": pagination_starting_after_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_climate_supplier(
    context: ToolContext,
    supplier_identifier: Annotated[
        str,
        "The unique identifier for the Climate supplier to be retrieved. This is required to fetch the supplier's information.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields to expand in the response for detailed information on the Climate supplier.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetClimateSuppliersSupplier'."]:
    """Fetches details of a specific Climate supplier.

    Use this tool to get detailed information about a Climate supplier using the supplier's identifier. It is useful for accessing supplier profiles managed by Stripe's Climate initiative."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/climate/suppliers/{supplier}".format(  # noqa: UP032
                supplier=supplier_identifier
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_confirmation_token_info(
    context: ToolContext,
    confirmation_token: Annotated[
        str,
        "The unique identifier of the confirmation token to retrieve details for. This is required.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields to expand in the response for additional details. Each field should be specified as a string.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetConfirmationTokensConfirmationToken'."
]:
    """Retrieves details of an existing confirmation token.

    This tool is used to retrieve information about a specific ConfirmationToken object in the Stripe system. It should be called when there is a need to obtain the details of a previously generated confirmation token."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/confirmation_tokens/{confirmation_token}".format(  # noqa: UP032
                confirmation_token=confirmation_token
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_country_specs(
    context: ToolContext,
    pagination_ending_before: Annotated[
        str | None,
        "The object ID to specify your place in the list for pagination, retrieving the previous page of results.",  # noqa: E501
    ] = None,
    expand_response_fields: Annotated[
        list[str] | None,
        "An array of strings specifying fields in the response to be expanded for more detailed information.",  # noqa: E501
    ] = None,
    number_of_country_specs_to_return: Annotated[
        int | None,
        "Number of country specification objects to return, ranging from 1 to 100. The default is 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_id: Annotated[
        str | None,
        "Object ID to define your place in the list for pagination. Use it to fetch the next page if available, based on the last object from a previous list call.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCountrySpecs'."]:
    """Retrieve all country specification objects from the API.

    This tool calls the Stripe API to list all available Country Spec objects, providing information about country-specific details."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/country_specs",
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": expand_response_fields,
                "limit": number_of_country_specs_to_return,
                "starting_after": pagination_starting_after_id,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_country_specifications(
    context: ToolContext,
    country_code: Annotated[
        str,
        "The ISO 3166-1 alpha-2 country code for which you want to retrieve specifications. For example, 'US' for the United States.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response to be expanded. Each field should be specified as a string.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCountrySpecsCountry'."]:
    """Retrieve country specifications using a country code.

    This tool is used to obtain the specifications for a specific country by providing its country code. It should be called when information related to the country's financial regulations, formats, or other specifications is needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/country_specs/{country}".format(country=country_code),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_stripe_coupon(
    context: ToolContext,
    coupon_id: Annotated[
        str,
        "The unique identifier of the coupon to delete on Stripe. This ID specifies which coupon should be deleted.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteCouponsCoupon'."]:
    """Delete a coupon in Stripe without affecting current users.

    Use this tool to delete a coupon on Stripe, preventing new customers from redeeming it. Existing customers with the coupon remain unaffected."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/coupons/{coupon}".format(coupon=coupon_id),  # noqa: UP032
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_coupon_details(
    context: ToolContext,
    coupon_id: Annotated[str, "The unique identifier of the coupon to retrieve details."],
    expanded_fields: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for additional details.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCouponsCoupon'."]:
    """Retrieve details of a coupon by its ID.

    Use this tool to fetch information about a specific coupon available in your Stripe account, identified by its unique ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/coupons/{coupon}".format(coupon=coupon_id),  # noqa: UP032
            params=remove_none_values({"expand": expanded_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_credit_note_lines(
    context: ToolContext,
    credit_note_id: Annotated[
        str, "The unique identifier of the credit note to retrieve line items from."
    ],
    pagination_ending_before: Annotated[
        str | None, "The object ID to paginate before, fetching the previous page in the list."
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response to be expanded. Allows detailed retrieval of related objects.",  # noqa: E501
    ] = None,
    max_objects_to_return: Annotated[
        int | None,
        "Specify the number of credit note line items to return. Must be between 1 and 100, default is 10.",  # noqa: E501
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "An object ID used for pagination to fetch the next page of the list. This ID should be the last object from a previous set of data.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCreditNotesCreditNoteLines'."]:
    """Fetch line items from a specified credit note.

    This tool retrieves line items from a given credit note, providing details and the option to access the full paginated list if needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/credit_notes/{credit_note}/lines".format(  # noqa: UP032
                credit_note=credit_note_id
            ),
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "limit": max_objects_to_return,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_credit_note(
    context: ToolContext,
    credit_note_id: Annotated[str, "The unique identifier of the credit note to be retrieved."],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response to be expanded for detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCreditNotesId'."]:
    """Retrieve details of a specific credit note by ID.

    Use this tool to get information about a credit note using its unique identifier. Ideal for retrieving specific credit note details from the Stripe service."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/credit_notes/{id}".format(id=credit_note_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def search_stripe_customers(
    context: ToolContext,
    search_query_string: Annotated[
        str,
        "The search query string used to search for customers. Refer to Stripe's Search Query Language documentation for syntax and supported fields.",  # noqa: E501
    ],
    expand_response_fields: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded. Provide the field names as strings.",  # noqa: E501
    ] = None,
    customer_result_limit: Annotated[
        int | None,
        "Specifies the maximum number of customer records to return, between 1 and 100. Default is 10.",  # noqa: E501
    ] = None,
    pagination_cursor: Annotated[
        str | None,
        "Cursor for paginating through results. Use 'next_page' from a previous response for subsequent results. Omit on the first call.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCustomersSearch'."]:
    """Search and retrieve customer data from Stripe.

    Use this tool to search for customers that have been previously created in Stripe using their Search Query Language. Note that search may not reflect the most recent updates instantly and may experience delays during outages. This tool is not available for use in India."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/search",
            params=remove_none_values({
                "expand": expand_response_fields,
                "limit": customer_result_limit,
                "page": pagination_cursor,
                "query": search_query_string,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_stripe_customer(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier of the customer to be deleted. This ID is required and should match the customer in the Stripe system.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteCustomersCustomer'."]:
    """Permanently delete a Stripe customer and cancel subscriptions.

    Use this tool to permanently delete a customer in Stripe. This action cannot be undone and will immediately cancel any active subscriptions associated with the customer."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}".format(customer=customer_id),  # noqa: UP032
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_customer_details(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier for the customer to retrieve details for. This is a string provided by Stripe.",  # noqa: E501
    ],
    expand_response_fields: Annotated[
        list[str] | None, "List of fields to expand in the response for detailed information."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCustomersCustomer'."]:
    """Retrieve details of a specific customer.

    This tool retrieves information about a specific customer from Stripe's database using their unique customer ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}".format(customer=customer_id),  # noqa: UP032
            params=remove_none_values({"expand": expand_response_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_balance_transactions(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier of the customer. This ID is used to retrieve balance transaction updates for that specific customer.",  # noqa: E501
    ],
    pagination_ending_before_cursor: Annotated[
        str | None,
        "A cursor ID used to fetch the previous page of balance transactions in pagination.",
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None, "A list of fields in the response that should be expanded."
    ] = None,
    result_limit: Annotated[
        int | None,
        "Sets the maximum number of balance transactions to retrieve, ranging from 1 to 100. Default is 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "A cursor for pagination. Use the object ID from the last received page to fetch the next page.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerBalanceTransactions'."
]:
    """Retrieve a customer's balance transaction updates.

    Fetches a list of transactions that have updated a customer's balance within Stripe."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/balance_transactions".format(  # noqa: UP032
                customer=customer_id
            ),
            params=remove_none_values({
                "ending_before": pagination_ending_before_cursor,
                "expand": fields_to_expand,
                "limit": result_limit,
                "starting_after": pagination_starting_after_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_balance_transaction(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier for the customer. This is required to retrieve the specific balance transaction.",  # noqa: E501
    ],
    transaction_id: Annotated[
        str, "The unique identifier for the customer balance transaction to retrieve."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "A list of fields to expand in the response for additional details."
    ] = None,
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'GetCustomersCustomerBalanceTransactionsTransaction'.",
]:
    """Retrieve a specific customer balance transaction from Stripe.

    This tool retrieves details about a specific balance transaction that impacted a customer's balance in Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/balance_transactions/{transaction}".format(  # noqa: UP032
                customer=customer_id, transaction=transaction_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_bank_accounts(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier of the customer whose bank accounts you want to retrieve. This ID is required to access the bank account details associated with a specific customer.",  # noqa: E501
    ],
    pagination_ending_before: Annotated[
        str | None,
        "An object ID used as a cursor to fetch the previous page of bank accounts in a paginated list.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields to expand in the response. Specify which aspects of the response should be expanded for detailed information.",  # noqa: E501
    ] = None,
    result_limit: Annotated[
        int | None,
        "The maximum number of bank accounts to return, ranging from 1 to 100. Defaults to 10 if not specified.",  # noqa: E501
    ] = None,
    pagination_cursor_starting_after: Annotated[
        str | None,
        "A string specifying the object ID to define your place in the list for pagination. Use this to fetch the next page of bank accounts.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerBankAccounts'."
]:
    """Retrieve bank accounts for a specific customer.

    Call this tool to obtain a list of bank accounts associated with a particular customer. Useful for viewing more than the 10 most recent bank accounts when paginating."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/bank_accounts".format(  # noqa: UP032
                customer=customer_id
            ),
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "limit": result_limit,
                "starting_after": pagination_cursor_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_bank_account_details(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier for the Stripe customer whose bank account details are being retrieved.",  # noqa: E501
    ],
    bank_account_id: Annotated[
        str,
        "The unique identifier for the specific bank account associated with the Stripe customer.",
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to expand for detailed information."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerBankAccountsId'."
]:
    """Retrieve details of a customer's bank account from Stripe.

    Use this tool to get specific details about a bank account associated with a Stripe customer. It helps when you need information beyond the most recent sources shown by default."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/bank_accounts/{id}".format(  # noqa: UP032
                customer=customer_id, id=bank_account_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_cards(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier for the customer whose cards are to be retrieved. This ID is required to obtain the card list.",  # noqa: E501
    ],
    pagination_ending_before: Annotated[
        str | None,
        "Object ID to define the cursor's place in pagination, used to fetch the previous page of the card list.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to be expanded for additional details."
    ] = None,
    card_retrieval_limit: Annotated[
        int | None,
        "Specify the maximum number of cards to retrieve. The limit must be between 1 and 100, with a default of 10 if not specified.",  # noqa: E501
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "An object ID indicating the position to start fetching the next page of the card list. Use this for pagination.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerCards'."]:
    """Retrieve a list of cards belonging to a customer.

    Use this tool to access a list of cards for a specific customer in the Stripe system. This is useful when more than the 10 most recent card sources are needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/cards".format(customer=customer_id),  # noqa: UP032
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "limit": card_retrieval_limit,
                "starting_after": pagination_starting_after_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_card_details(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier for the customer whose card details are being retrieved. This is required to specify which customer's card information you want to access.",  # noqa: E501
    ],
    card_id: Annotated[
        str,
        "The unique identifier of the card to retrieve details for. This is specific to the card associated with the customer.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for more detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerCardsId'."]:
    """Retrieve details about a specific card for a customer.

    This tool retrieves information about a specific card associated with a customer, allowing you to access details beyond the most recent 10 cards available directly on the customer object."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/cards/{id}".format(  # noqa: UP032
                customer=customer_id, id=card_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_cash_balance(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier of the customer whose cash balance is being retrieved. This ID is used to specify which customer's balance should be returned.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "An array of strings specifying which fields in the response should be expanded for additional details.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerCashBalance'."]:
    """Retrieve a customer's cash balance on Stripe.

    This tool retrieves the cash balance of a specific customer from Stripe. It should be called when there's a need to check the available balance for a customer account."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/cash_balance".format(  # noqa: UP032
                customer=customer_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_cash_balance_transactions(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier of the customer whose cash balance transactions are to be retrieved. This ID is required for the API call.",  # noqa: E501
    ],
    pagination_cursor_ending_before: Annotated[
        str | None,
        "A string representing the ID used for pagination to fetch the previous page of transactions.",  # noqa: E501
    ] = None,
    expand_fields: Annotated[
        list[str] | None, "List of fields to expand in the response for detailed information."
    ] = None,
    transaction_limit: Annotated[
        int | None, "The number of transactions to return, between 1 and 100. Default is 10."
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "Object ID cursor for pagination to continue listing transactions after a specified object.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerCashBalanceTransactions'."
]:
    """Retrieve transactions modifying a customer's cash balance.

    This tool returns a list of transactions that have modified a customer's cash balance. Use this to track financial changes in a customer's account."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/cash_balance_transactions".format(  # noqa: UP032
                customer=customer_id
            ),
            params=remove_none_values({
                "ending_before": pagination_cursor_ending_before,
                "expand": expand_fields,
                "limit": transaction_limit,
                "starting_after": pagination_starting_after_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_cash_balance_transaction(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier of the customer whose cash balance transaction is to be retrieved.",
    ],
    transaction_id: Annotated[
        str, "The unique identifier for the cash balance transaction to be retrieved."
    ],
    expand_fields_in_response: Annotated[
        list[str] | None, "List of fields to expand in the response for additional details."
    ] = None,
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'GetCustomersCustomerCashBalanceTransactionsTransaction'.",
]:
    """Retrieve a cash balance transaction for a customer.

    This tool retrieves information about a specific cash balance transaction that affected a customer's cash balance in Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/cash_balance_transactions/{transaction}".format(  # noqa: UP032
                customer=customer_id, transaction=transaction_id
            ),
            params=remove_none_values({"expand": expand_fields_in_response}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def remove_customer_discount(
    context: ToolContext,
    customer_id: Annotated[
        str, "The unique identifier for the customer whose discount is to be removed."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteCustomersCustomerDiscount'."]:
    """Remove the current discount applied to a customer.

    This tool removes the discount that is currently applied to a specific customer when called. It should be used when there is a need to update or clear a customer's discount information."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/discount".format(  # noqa: UP032
                customer=customer_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_customer_discount(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier for the customer whose discount information you want to retrieve.",
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response to expand. Use to get additional related information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerDiscount'."]:
    """Retrieve a customer's discount information.

    Use this tool to get information about a specific customer's discount in Stripe. It provides details on any discounts applied to a customer's account."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/discount".format(  # noqa: UP032
                customer=customer_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_payment_methods(
    context: ToolContext,
    customer_id: Annotated[
        str, "Unique identifier for the customer whose payment methods are to be retrieved."
    ],
    enable_redisplay_setting: Annotated[
        str | None,
        "Indicates if the payment method can be shown again in a checkout flow. Options: 'always', 'limited', 'unspecified'.",  # noqa: E501
    ] = None,
    pagination_ending_before_id: Annotated[
        str | None, "An object ID used to paginate backwards by defining the end of the list."
    ] = None,
    response_fields_to_expand: Annotated[
        list[str] | None, "A list of fields to expand in the response for detailed information."
    ] = None,
    max_payment_methods_returned: Annotated[
        int | None,
        "Limit the number of payment methods returned. Accepts a value between 1 and 100, with a default of 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "Cursor for pagination that defines the start point in the list. Use the ID of the last object from the previous page.",  # noqa: E501
    ] = None,
    payment_method_type_filter: Annotated[
        str | None,
        "Specify a payment method type to filter the list. Without filtering, all types are included. Choose from options like 'card', 'paypal', etc.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerPaymentMethods'."
]:
    """Retrieve payment methods for a specific customer.

    This tool should be called to obtain a list of payment methods associated with a particular customer in Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/payment_methods".format(  # noqa: UP032
                customer=customer_id
            ),
            params=remove_none_values({
                "allow_redisplay": enable_redisplay_setting,
                "ending_before": pagination_ending_before_id,
                "expand": response_fields_to_expand,
                "limit": max_payment_methods_returned,
                "starting_after": pagination_starting_after_cursor,
                "type": payment_method_type_filter,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_payment_method(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier for the customer whose payment method information is being retrieved. This ID should be a string matching the customer's record in Stripe.",  # noqa: E501
    ],
    payment_method_id: Annotated[
        str, "The unique identifier for the payment method to retrieve for the customer."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the payment method response that should be expanded for more details.",
    ] = None,
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'GetCustomersCustomerPaymentMethodsPaymentMethod'.",
]:
    """Retrieve a customer's specific payment method.

    This tool retrieves detailed information about a specific PaymentMethod linked to a given customer. It should be called when there is a need to access or verify details of a particular payment method for a customer in Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/payment_methods/{payment_method}".format(  # noqa: UP032
                customer=customer_id, payment_method=payment_method_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def list_customer_payment_sources(
    context: ToolContext,
    customer_id: Annotated[
        str, "The unique identifier for the customer whose payment sources you want to retrieve."
    ],
    pagination_ending_before: Annotated[
        str | None,
        "A cursor for pagination to fetch the previous page. Use an object ID from your list request.",  # noqa: E501
    ] = None,
    expand_response_fields: Annotated[
        list[str] | None, "List of fields in the response to be expanded for additional details."
    ] = None,
    max_payment_sources_to_return: Annotated[
        int | None,
        "Set the maximum number of payment sources to return, from 1 to 100. Defaults to 10 if not specified.",  # noqa: E501
    ] = None,
    filter_by_object_type: Annotated[
        str | None,
        "Filter payment sources based on a specific object type (e.g., card, bank_account).",
    ] = None,
    pagination_start_cursor: Annotated[
        str | None,
        "An object ID (string) that specifies your place in the list to fetch the next page. Use it for pagination.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerSources'."]:
    """Retrieve payment sources for a specified customer.

    Use this tool to list all payment sources for a given customer ID in Stripe."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/sources".format(  # noqa: UP032
                customer=customer_id
            ),
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": expand_response_fields,
                "limit": max_payment_sources_to_return,
                "object": filter_by_object_type,
                "starting_after": pagination_start_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_customer_payment_source(
    context: ToolContext,
    customer_id: Annotated[
        str, "The unique identifier for the customer whose payment source needs to be retrieved."
    ],
    source_id: Annotated[
        str, "The unique identifier of the payment source to retrieve for the specified customer."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields to expand in the response for detailed information."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerSourcesId'."]:
    """Retrieve a specified source for a given customer.

    Use this tool to get details about a specific payment source associated with a customer in Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/sources/{id}".format(  # noqa: UP032
                customer=customer_id, id=source_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_subscriptions(
    context: ToolContext,
    customer_id: Annotated[
        str, "The unique identifier for the customer whose subscriptions are being retrieved."
    ],
    pagination_ending_before_cursor: Annotated[
        str | None,
        "An object ID to define your position in pagination. Use this cursor to fetch the previous page of subscriptions.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for additional details.",
    ] = None,
    subscription_limit: Annotated[
        int | None,
        "The maximum number of subscription objects to return. Must be between 1 and 100, defaulting to 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_object_id: Annotated[
        str | None,
        "An object ID used as a cursor to fetch the next page of subscriptions in a paginated list.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerSubscriptions'."
]:
    """Retrieve a customer's active subscriptions.

    Use this tool to obtain a list of active subscriptions for a specific customer. Useful for viewing subscription details beyond the default 10 most recent active subscriptions available on the customer object."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/subscriptions".format(  # noqa: UP032
                customer=customer_id
            ),
            params=remove_none_values({
                "ending_before": pagination_ending_before_cursor,
                "expand": fields_to_expand,
                "limit": subscription_limit,
                "starting_after": pagination_starting_after_object_id,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_stripe_subscription_by_id(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier for the customer whose subscription is being retrieved. Provide this to specify which customer's subscription details to fetch.",  # noqa: E501
    ],
    subscription_id: Annotated[
        str,
        "The identifier of the subscription to retrieve. Required to fetch the specific subscription details.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields to expand in the subscription response, allowing for additional details.",
    ] = None,
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'GetCustomersCustomerSubscriptionsSubscriptionExposedId'.",
]:
    """Retrieve a Stripe subscription by its ID.

    This tool retrieves a subscription from Stripe using the provided subscription ID for a specific customer. Use it when you need details about a specific subscription."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/subscriptions/{subscription_exposed_id}".format(  # noqa: UP032
                customer=customer_id, subscription_exposed_id=subscription_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def remove_customer_subscription_discount(
    context: ToolContext,
    customer_id: Annotated[
        str, "The unique identifier for the customer whose subscription discount should be removed."
    ],
    subscription_id: Annotated[
        str,
        "The unique identifier for the customer's subscription from which the discount will be removed.",  # noqa: E501
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'DeleteCustomersCustomerSubscriptionsSubscriptionExposedIdDiscount'.",  # noqa: E501
]:
    """Removes the discount from a customer's subscription.

    This tool is used to remove the currently applied discount on a specific customer's subscription."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/subscriptions/{subscription_exposed_id}/discount".format(  # noqa: UP032
                customer=customer_id, subscription_exposed_id=subscription_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_subscription_discount(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The unique identifier of the customer whose subscription discount details are being retrieved.",  # noqa: E501
    ],
    subscription_id: Annotated[
        str, "The unique identifier for the customer's subscription to retrieve discount details."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields to expand in the response for more detailed information."
    ] = None,
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'GetCustomersCustomerSubscriptionsSubscriptionExposedIdDiscount'.",  # noqa: E501
]:
    """Retrieve discount details for a customer's subscription.

    Use this tool to get the discount information associated with a specific subscription for a particular customer in Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/subscriptions/{subscription_exposed_id}/discount".format(  # noqa: UP032
                customer=customer_id, subscription_exposed_id=subscription_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_tax_ids(
    context: ToolContext,
    customer_id: Annotated[
        str,
        "The ID of the customer for whom the tax IDs are being retrieved. This is a required field.",  # noqa: E501
    ],
    pagination_ending_before: Annotated[
        str | None,
        "Cursor object ID to fetch the previous page in a paginated list. Use the ID from the starting object of the current list.",  # noqa: E501
    ] = None,
    expand_fields: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded. Provide field names as strings.",
    ] = None,
    max_number_of_tax_ids: Annotated[
        int | None,
        "Specify the maximum number of tax IDs to return. Accepts an integer between 1 and 100, with a default value of 10.",  # noqa: E501
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "An object ID from the current list to continue fetching the next page in pagination.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerTaxIds'."]:
    """Retrieve a customer's tax IDs from their profile.

    Call this tool to get a list of all tax IDs associated with a specific customer. It gathers the tax identification numbers stored in a customer's account on Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/tax_ids".format(  # noqa: UP032
                customer=customer_id
            ),
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": expand_fields,
                "limit": max_number_of_tax_ids,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_customer_tax_id(
    context: ToolContext,
    customer_identifier: Annotated[
        str,
        "The unique identifier for the customer whose tax ID will be deleted. This is a string provided by Stripe.",  # noqa: E501
    ],
    tax_id: Annotated[str, "The unique identifier of the tax ID to be deleted for the customer."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteCustomersCustomerTaxIdsId'."]:
    """Deletes a customer's existing tax ID.

    This tool is used to remove an existing tax ID associated with a specific customer in Stripe. Call this tool to manage customer tax ID records by deleting unnecessary or outdated entries."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/tax_ids/{id}".format(  # noqa: UP032
                customer=customer_identifier, id=tax_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_customer_tax_id(
    context: ToolContext,
    customer_identifier: Annotated[
        str, "The unique identifier of the customer whose tax ID is to be retrieved."
    ],
    tax_id_identifier: Annotated[
        str, "The unique identifier of the customer's tax ID to be retrieved."
    ],
    expand_response_fields: Annotated[
        list[str] | None,
        "A list of field names in the response that should be expanded for more detailed information.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetCustomersCustomerTaxIdsId'."]:
    """Retrieve a specific customer's tax ID information.

    This tool retrieves the tax ID object for a specified customer using the given tax ID identifier."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/customers/{customer}/tax_ids/{id}".format(  # noqa: UP032
                customer=customer_identifier, id=tax_id_identifier
            ),
            params=remove_none_values({"expand": expand_response_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_dispute_by_id(
    context: ToolContext,
    dispute_id: Annotated[
        str,
        "The unique identifier of the dispute to be retrieved. This ID can be used to fetch detailed information about the specific dispute.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the dispute response that should be expanded for additional details.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetDisputesDispute'."]:
    """Retrieve details of a dispute using its ID.

    This tool is used to fetch detailed information about a specific dispute by providing its ID. It should be called when detailed information about a particular dispute is needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/disputes/{dispute}".format(dispute=dispute_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_active_entitlements(
    context: ToolContext,
    customer_id: Annotated[
        str, "The unique identifier of the customer whose active entitlements are being retrieved."
    ],
    pagination_ending_before: Annotated[
        str | None,
        "An object ID cursor to fetch the previous page of the list of active entitlements.",
    ] = None,
    expand_fields_in_response: Annotated[
        list[str] | None,
        "An array of field names to be expanded in the response from Stripe. Use this to include additional details related to specific entities.",  # noqa: E501
    ] = None,
    max_number_of_entitlements: Annotated[
        int | None,
        "Maximum number of active entitlements to retrieve for the customer, between 1 and 100. Default is 10.",  # noqa: E501
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "Use this to specify where to start the list pagination. Provide the object ID from where the list should continue.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetEntitlementsActiveEntitlements'."
]:
    """Retrieve active entitlements for a customer from Stripe.

    This tool fetches a list of active entitlements for a specific customer using Stripe's API. It's used when you need to know what entitlements a customer currently has."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/entitlements/active_entitlements",
            params=remove_none_values({
                "customer": customer_id,
                "ending_before": pagination_ending_before,
                "expand": expand_fields_in_response,
                "limit": max_number_of_entitlements,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_active_entitlement(
    context: ToolContext,
    entitlement_id: Annotated[str, "The unique identifier of the active entitlement to retrieve."],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response that should be expanded for additional details.",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetEntitlementsActiveEntitlementsId'."
]:
    """Retrieve details of an active entitlement by ID.

    This tool retrieves information about an active entitlement using its ID. It should be used to fetch details related to a specific active entitlement in Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/entitlements/active_entitlements/{id}".format(  # noqa: UP032
                id=entitlement_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_stripe_entitlement_features(
    context: ToolContext,
    pagination_ending_before: Annotated[
        str | None,
        "Cursor for pagination defining the position in list. Use to fetch previous page by providing object ID.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to be expanded."
    ] = None,
    object_return_limit: Annotated[
        int | None,
        "Specify the number of features to return, ranging between 1 and 100. Defaults to 10 if not provided.",  # noqa: E501
    ] = None,
    filter_by_lookup_key: Annotated[
        str | None, "Filter results to only include features with the specified lookup key."
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "A cursor for pagination. Use the object ID from the last item of your current list to fetch the next page.",  # noqa: E501
    ] = None,
    include_archived_features: Annotated[
        bool | None, "Set to true to include only archived features, or false to exclude them."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetEntitlementsFeatures'."]:
    """Retrieve a list of entitlement features from Stripe.

    Call this tool to obtain a list of features related to entitlements from Stripe's API."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/entitlements/features",
            params=remove_none_values({
                "archived": include_archived_features,
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "limit": object_return_limit,
                "lookup_key": filter_by_lookup_key,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_feature_details(
    context: ToolContext,
    feature_id: Annotated[str, "The unique identifier of the feature to retrieve details for."],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response to be expanded for more detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetEntitlementsFeaturesId'."]:
    """Fetches details for a specific feature by ID.

    Use this tool to retrieve detailed information about a specific feature using its ID within the Stripe system."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/entitlements/features/{id}".format(id=feature_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_stripe_event_details(
    context: ToolContext,
    event_identifier: Annotated[
        str,
        "The unique identifier of the event to retrieve details for. Typically received via a webhook and must have been created in the last 30 days.",  # noqa: E501
    ],
    fields_to_expand_in_response: Annotated[
        list[str] | None,
        "List of fields to be expanded in the response. Provide field names as strings.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetEventsId'."]:
    """Retrieve details of a Stripe event using its unique ID.

    Use this tool to get information about a Stripe event created in the last 30 days. You need to provide the unique event identifier, typically received through a webhook."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/events/{id}".format(id=event_identifier),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand_in_response}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_exchange_rates(
    context: ToolContext,
    pagination_ending_before_currency: Annotated[
        str | None,
        "The currency code to define your position for fetching the previous page in the exchange rate list.",  # noqa: E501
    ] = None,
    response_fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to be expanded for detailed information."
    ] = None,
    result_limit: Annotated[
        int | None,
        "Set the maximum number of exchange rate objects to return, ranging from 1 up to the maximum number supported by Stripe.",  # noqa: E501
    ] = None,
    pagination_starting_currency: Annotated[
        str | None,
        "The currency code to define the starting point in the paginated list of exchange rates.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetExchangeRates'."]:
    """Retrieve Stripe's supported foreign currency exchange rates.

    Fetches current exchange rates for foreign currencies supported by Stripe. Note: This API is deprecated; consider using the FX Quotes API instead."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/exchange_rates",
            params=remove_none_values({
                "ending_before": pagination_ending_before_currency,
                "expand": response_fields_to_expand,
                "limit": result_limit,
                "starting_after": pagination_starting_currency,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_deprecated_exchange_rates(
    context: ToolContext,
    currency_rate_id: Annotated[
        str,
        "The currency code (e.g., 'USD') to retrieve exchange rates for. Use the deprecated Exchange Rate API responsibly.",  # noqa: E501
    ],
    expand_fields: Annotated[
        list[str] | None,
        "List of fields to be expanded in the response. Each field is specified as a string.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetExchangeRatesRateId'."]:
    """Retrieves deprecated exchange rates for a given currency.

    This tool fetches exchange rates from one currency to all supported currencies using the deprecated Exchange Rate API from Stripe. Use this only if the newer FX Quotes API is not suitable for your needs."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/exchange_rates/{rate_id}".format(  # noqa: UP032
                rate_id=currency_rate_id
            ),
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_file_link(
    context: ToolContext,
    file_link_id: Annotated[
        str,
        "The ID of the file link to retrieve details for. This is used to fetch the specific file link from Stripe.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "An array of strings specifying which fields in the response should be expanded for additional details.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetFileLinksLink'."]:
    """Fetches a file link using its ID.

    Use this tool to retrieve information about a specific file link by providing its ID. Ideal for accessing details about file links stored in Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/file_links/{link}".format(link=file_link_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_file_details(
    context: ToolContext,
    file_id: Annotated[
        str, "The unique identifier for the file object whose details you want to retrieve."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for additional details.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetFilesFile'."]:
    """Retrieve details of an existing file object from Stripe.

    Fetches the details of a file object using its unique file ID on Stripe. Useful for accessing metadata and information about uploaded files."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/files/{file}".format(file=file_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_financial_connections_account_details(
    context: ToolContext,
    financial_account_identifier: Annotated[
        str, "The unique identifier for the Financial Connections Account to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to be expanded for additional details."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetFinancialConnectionsAccountsAccount'."
]:
    """Retrieve details of a Financial Connections Account.

    Call this tool to get detailed information about a specific Financial Connections Account using the account identifier."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/financial_connections/accounts/{account}".format(  # noqa: UP032
                account=financial_account_identifier
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_financial_account_owners(
    context: ToolContext,
    ownership_object_id: Annotated[
        str, "The ID of the ownership object from which to fetch the account owners."
    ],
    account_id: Annotated[
        str, "The unique identifier of the financial account to retrieve its owners."
    ],
    pagination_cursor_ending_before: Annotated[
        str | None,
        "An ID to fetch the previous page in pagination, defining your place in the list.",
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of field names in the response to be expanded, specified as an array of strings.",
    ] = None,
    object_limit: Annotated[
        int | None,
        "Specifies the maximum number of account owners to return, ranging from 1 to 100, with a default of 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "A cursor indicating the starting point for pagination in a list. Use the object ID from the previous response to fetch the next page.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetFinancialConnectionsAccountsAccountOwners'."
]:
    """Retrieve owners of a specified financial account.

    This tool is used to list all the owners of a given financial account. It is essential when you need to verify or display the ownership details of an account."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/financial_connections/accounts/{account}/owners".format(  # noqa: UP032
                account=account_id
            ),
            params=remove_none_values({
                "ending_before": pagination_cursor_ending_before,
                "expand": fields_to_expand,
                "limit": object_limit,
                "ownership": ownership_object_id,
                "starting_after": pagination_starting_after_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_financial_connections_session(
    context: ToolContext,
    financial_connection_session_id: Annotated[
        str, "The unique identifier of the Financial Connections Session to retrieve."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "An array of strings specifying which fields in the response should be expanded for additional details.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetFinancialConnectionsSessionsSession'."
]:
    """Retrieve details of a Financial Connections Session.

    Use this tool to obtain detailed information about a specific Financial Connections Session from Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/financial_connections/sessions/{session}".format(  # noqa: UP032
                session=financial_connection_session_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_financial_transaction_details(
    context: ToolContext,
    transaction_id: Annotated[
        str, "The unique identifier of the financial transaction to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields to expand in the response to show additional details."
    ] = None,
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'GetFinancialConnectionsTransactionsTransaction'.",
]:
    """Retrieve details of a specific financial transaction.

    This tool fetches details for a specific Financial Connections transaction, useful for accessing transaction information."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/financial_connections/transactions/{transaction}".format(  # noqa: UP032
                transaction=transaction_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_forwarding_request(
    context: ToolContext,
    forwarding_request_id: Annotated[
        str, "The unique identifier for the ForwardingRequest object to be retrieved."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields to expand in the response for detailed information."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetForwardingRequestsId'."]:
    """Fetch a specific ForwardingRequest object using its ID.

    Use this tool to retrieve information about a ForwardingRequest by providing its unique ID. Ideal for accessing details of a specific forwarding request in the Stripe service."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/forwarding/requests/{id}".format(  # noqa: UP032
                id=forwarding_request_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_stripe_verification_report(
    context: ToolContext,
    verification_report_id: Annotated[
        str, "The unique identifier of the verification report to fetch from Stripe."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "A list of fields in the response to expand for additional detail."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetIdentityVerificationReportsReport'."
]:
    """Retrieve details of an existing Stripe verification report.

    Use this tool to fetch detailed information of a specific identity verification report from Stripe. This is useful for reviewing identity verification results or audit purposes."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/identity/verification_reports/{report}".format(  # noqa: UP032
                report=verification_report_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_verification_session_details(
    context: ToolContext,
    verification_session_id: Annotated[
        str, "The unique identifier of the Stripe VerificationSession to be retrieved."
    ],
    expand_response_fields: Annotated[
        list[str] | None,
        "A list of fields in the response to be expanded for additional details. Use this to customize the verbosity of the response.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetIdentityVerificationSessionsSession'."
]:
    """Retrieve details of a Stripe verification session.

    Use this tool to get information about a specific Stripe VerificationSession. It's helpful when the session status is 'requires_input' to obtain a valid client_secret or URL for re-submission."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/identity/verification_sessions/{session}".format(  # noqa: UP032
                session=verification_session_id
            ),
            params=remove_none_values({"expand": expand_response_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_invoice_payment(
    context: ToolContext,
    invoice_payment_id: Annotated[
        str,
        "The ID of the invoice payment to retrieve details for. This ID is required to fetch the payment information.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields to be expanded in the response. Each field should be specified as a string.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetInvoicePaymentsInvoicePayment'."
]:
    """Fetch the details of a specific invoice payment by ID.

    Use this tool to retrieve the payment details for a given invoice ID from the Stripe service."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/invoice_payments/{invoice_payment}".format(  # noqa: UP032
                invoice_payment=invoice_payment_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_invoice_rendering_templates(
    context: ToolContext,
    pagination_ending_before: Annotated[
        str | None,
        "A pagination cursor indicating the object ID to end before when listing templates. Use this to fetch the previous page.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for more detailed information.",
    ] = None,
    result_limit: Annotated[
        int | None,
        "Specify the maximum number of invoice rendering templates to return, ranging from 1 to 100. Defaults to 10.",  # noqa: E501
    ] = None,
    pagination_starting_after: Annotated[
        str | None, "Object ID defining your place in the list to fetch the next page."
    ] = None,
    template_status: Annotated[
        str | None, "Filter templates by their status: 'active' or 'archived'."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetInvoiceRenderingTemplates'."]:
    """Retrieve all invoice rendering templates by creation date.

    This tool fetches a list of all invoice rendering templates, organized by creation date with the latest ones first. Use it to access and manage invoice templates efficiently."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/invoice_rendering_templates",
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "limit": result_limit,
                "starting_after": pagination_starting_after,
                "status": template_status,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_invoice_template(
    context: ToolContext,
    invoice_template_id: Annotated[
        str, "The unique identifier for the invoice rendering template you want to retrieve."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for detailed information.",
    ] = None,
    template_version: Annotated[
        int | None,
        "Specify the version number of the invoice rendering template to retrieve. If omitted, the latest version is returned.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetInvoiceRenderingTemplatesTemplate'."
]:
    """Fetch an invoice rendering template by ID.

    Use this tool to retrieve details of a specific invoice rendering template from Stripe. By default, it returns the latest version of the template, but you can specify a version to retrieve an older version."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/invoice_rendering_templates/{template}".format(  # noqa: UP032
                template=invoice_template_id
            ),
            params=remove_none_values({"expand": fields_to_expand, "version": template_version}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_invoice_item(
    context: ToolContext,
    invoice_item_id: Annotated[
        str,
        "The unique identifier of the invoice item to be deleted. It must be either unattached or part of a draft invoice.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteInvoiceitemsInvoiceitem'."]:
    """Delete an invoice item from a draft or unattached invoice.

    Use this tool to delete an invoice item that isn't attached to a final invoice or is part of a draft invoice."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/invoiceitems/{invoiceitem}".format(  # noqa: UP032
                invoiceitem=invoice_item_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_invoice_item_details(
    context: ToolContext,
    invoice_item_id: Annotated[str, "The ID of the invoice item to retrieve details for."],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to expand for more detailed information."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetInvoiceitemsInvoiceitem'."]:
    """Retrieve details of a specific invoice item by ID."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/invoiceitems/{invoiceitem}".format(  # noqa: UP032
                invoiceitem=invoice_item_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def search_stripe_invoices(
    context: ToolContext,
    search_query_string: Annotated[
        str,
        "The search query string using Stripe's Search Query Language. Refer to Stripe's documentation for syntax and supported fields.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response to be expanded for additional details. Provide field names as strings.",  # noqa: E501
    ] = None,
    result_limit: Annotated[
        int | None,
        "Defines the maximum number of invoice records to return, ranging from 1 to 100. Defaults to 10 if not specified.",  # noqa: E501
    ] = None,
    pagination_cursor: Annotated[
        str | None,
        "A cursor for pagination to retrieve subsequent pages. Use the next_page value from a previous response; exclude for the first call.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetInvoicesSearch'."]:
    """Search for previously created Stripe invoices.

    This tool searches for invoices you've previously created using Stripe's Search Query Language. It should not be used in read-after-write flows needing strict consistency. Data is typically searchable within a minute but could take up to an hour during outages. Not available for merchants in India."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/invoices/search",
            params=remove_none_values({
                "expand": fields_to_expand,
                "limit": result_limit,
                "page": pagination_cursor,
                "query": search_query_string,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_invoice_draft(
    context: ToolContext,
    invoice_id: Annotated[
        str,
        "The unique identifier of the draft invoice to be permanently deleted. Cannot be used on finalized invoices or those associated with subscriptions.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteInvoicesInvoice'."]:
    """Permanently delete a draft invoice.

    Use this tool to permanently delete a draft invoice that is not finalized or associated with a subscription. Once deleted, this action cannot be undone."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/invoices/{invoice}".format(invoice=invoice_id),  # noqa: UP032
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_invoice_by_id(
    context: ToolContext,
    invoice_id: Annotated[str, "The unique identifier for the invoice to retrieve."],
    expand_fields_in_response: Annotated[
        list[str] | None,
        "A list of fields in the invoice response that should be expanded for more detailed information.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetInvoicesInvoice'."]:
    """Retrieve details of an invoice using its ID.

    This tool should be called to obtain information about a specific invoice by providing its ID. It retrieves details associated with the given invoice ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/invoices/{invoice}".format(invoice=invoice_id),  # noqa: UP032
            params=remove_none_values({"expand": expand_fields_in_response}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_invoice_line_items(
    context: ToolContext,
    invoice_id: Annotated[
        str,
        "The unique identifier for the invoice to retrieve line items from. Provide this ID to specify which invoice's line items you want to access.",  # noqa: E501
    ],
    pagination_ending_before_cursor: Annotated[
        str | None, "A cursor ID to fetch the previous page of line items in the invoice list."
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "List the fields in the invoice line items response that should be expanded for more details.",  # noqa: E501
    ] = None,
    max_line_items_to_return: Annotated[
        int | None,
        "The maximum number of line items to return. It can range from 1 to 100, with a default of 10.",  # noqa: E501
    ] = None,
    pagination_start_after: Annotated[
        str | None,
        "An object ID defining your place in the list for pagination, used to fetch the next page of invoice line items.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetInvoicesInvoiceLines'."]:
    """Fetch line items from a specific invoice.

    Use this tool to get the line items and their total count from a specific invoice. This is useful when you need detailed information about the charges in an invoice."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/invoices/{invoice}/lines".format(invoice=invoice_id),  # noqa: UP032
            params=remove_none_values({
                "ending_before": pagination_ending_before_cursor,
                "expand": fields_to_expand,
                "limit": max_line_items_to_return,
                "starting_after": pagination_start_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_issuing_authorization(
    context: ToolContext,
    authorization_id: Annotated[
        str, "The unique identifier for the Issuing Authorization object to retrieve."
    ],
    expand_fields: Annotated[
        list[str] | None,
        "List of strings specifying which fields in the response should be expanded.",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetIssuingAuthorizationsAuthorization'."
]:
    """Fetches details of an Issuing Authorization object.

    Use this tool to retrieve a specific Issuing Authorization object from Stripe by providing the authorization ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/issuing/authorizations/{authorization}".format(  # noqa: UP032
                authorization=authorization_id
            ),
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_issuing_cardholder(
    context: ToolContext,
    cardholder_id: Annotated[
        str, "The unique identifier of the cardholder to retrieve details for, in string format."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "An array of field names to expand in the response for additional details.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetIssuingCardholdersCardholder'."]:
    """Retrieve details of an issuing cardholder.

    This tool retrieves the details of an issuing cardholder from the Stripe API. It should be called when you need specific information about a cardholder associated with a Stripe issuing account."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/issuing/cardholders/{cardholder}".format(  # noqa: UP032
                cardholder=cardholder_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_issuing_card_details(
    context: ToolContext,
    card_id: Annotated[
        str,
        "The unique identifier of the issuing card you want to retrieve details for. This is required.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None, "An array of fields to expand in the response for additional details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetIssuingCardsCard'."]:
    """Retrieve details of a specific issuing card.

    Use this tool to get detailed information about an Issuing Card object from Stripe. It should be called when you need to fetch the details of a specific card."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/issuing/cards/{card}".format(card=card_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_issuing_dispute(
    context: ToolContext,
    dispute_id: Annotated[str, "The unique identifier of the Issuing Dispute to be retrieved."],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the dispute response that should be expanded for more detailed information.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetIssuingDisputesDispute'."]:
    """Fetch the details of a specific issuing dispute.

    Use this tool to retrieve an Issuing Dispute object from Stripe by providing the dispute identifier."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/issuing/disputes/{dispute}".format(dispute=dispute_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_personalization_design(
    context: ToolContext,
    personalization_design_id: Annotated[
        str,
        "The ID of the personalization design to retrieve. This is used to specify which design object's details are desired.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to be expanded for additional details."
    ] = None,
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'GetIssuingPersonalizationDesignsPersonalizationDesign'.",
]:
    """Retrieve a personalization design object by ID.

    Use this tool to get the details of a specific personalization design by providing its ID. Ideal for retrieving information related to issuing personalization designs."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/issuing/personalization_designs/{personalization_design}".format(  # noqa: UP032
                personalization_design=personalization_design_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_latest_physical_bundles(
    context: ToolContext,
    pagination_end_before_id: Annotated[
        str | None, "An object ID used for pagination to fetch the previous page of the list."
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None, "List of response fields to expand for more detailed information."
    ] = None,
    number_of_bundles_limit: Annotated[
        int | None,
        "Specify the maximum number of physical bundle objects to return, ranging from 1 to 100. Default is 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_id: Annotated[
        str | None,
        "Provide the object ID to continue pagination from the next item after it in the list.",
    ] = None,
    filter_status: Annotated[
        str | None,
        "Filter physical bundles by status. Options include 'active', 'inactive', or 'review'.",
    ] = None,
    filter_by_bundle_type: Annotated[
        str | None,
        "Specify the type of physical bundles to return. Options are 'custom' or 'standard'.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetIssuingPhysicalBundles'."]:
    """Retrieve the latest physical bundle objects from Stripe.

    This tool fetches a list of physical bundle objects from Stripe, sorted by creation date with the newest first. It's useful for obtaining the most recent physical bundles."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/issuing/physical_bundles",
            params=remove_none_values({
                "ending_before": pagination_end_before_id,
                "expand": fields_to_expand,
                "limit": number_of_bundles_limit,
                "starting_after": pagination_starting_after_id,
                "status": filter_status,
                "type": filter_by_bundle_type,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_physical_bundle(
    context: ToolContext,
    physical_bundle_id: Annotated[str, "The unique identifier of the physical bundle to retrieve."],
    fields_to_expand: Annotated[
        list[str] | None,
        "Comma-separated list of fields in the response to be expanded for additional details.",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetIssuingPhysicalBundlesPhysicalBundle'."
]:
    """Retrieve details of a physical bundle.

    Use this tool to get information about a specific physical bundle in the Stripe issuing service. Useful for accessing current data about a particular bundle."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/issuing/physical_bundles/{physical_bundle}".format(  # noqa: UP032
                physical_bundle=physical_bundle_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_issuing_settlement(
    context: ToolContext,
    settlement_id: Annotated[
        str, "The unique identifier of the Issuing Settlement to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields to be expanded in the response for detailed information."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetIssuingSettlementsSettlement'."]:
    """Fetch details of an Issuing Settlement object.

    Use this tool to retrieve information about a specific Issuing Settlement in the Stripe platform. It is useful for getting the details of settlements related to issuing transactions."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/issuing/settlements/{settlement}".format(  # noqa: UP032
                settlement=settlement_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_issuing_token_info(
    context: ToolContext,
    issuing_token_id: Annotated[
        str,
        "The unique identifier of the Issuing Token to retrieve information for. This is required to specify which token's details are needed from Stripe.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response to be expanded for detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetIssuingTokensToken'."]:
    """Retrieve details of an Issuing Token.

    Use this tool to obtain information about a specific Issuing Token from Stripe."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/issuing/tokens/{token}".format(token=issuing_token_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_issuing_transaction(
    context: ToolContext,
    transaction_id: Annotated[
        str, "The unique identifier for the issuing transaction to be retrieved."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for more detailed information.",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetIssuingTransactionsTransaction'."
]:
    """Fetch details of an issuing transaction by ID.

    This tool retrieves information about a specific issuing transaction using its unique ID. It is used to gather details on transactions processed through Stripe's issuing services."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/issuing/transactions/{transaction}".format(  # noqa: UP032
                transaction=transaction_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_financial_session_details(
    context: ToolContext,
    session_identifier: Annotated[
        str, "The unique identifier for the financial connection session to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "An array of fields in the response that should be expanded to include more details.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetLinkAccountSessionsSession'."]:
    """Retrieve details of a financial connection session.

    Use this tool to get information about a specific financial connection session through Stripe. It's useful for accessing session details based on a session identifier."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/link_account_sessions/{session}".format(  # noqa: UP032
                session=session_identifier
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_linked_account_details(
    context: ToolContext,
    account_id: Annotated[
        str, "The unique identifier for the financial connections account to retrieve details for."
    ],
    expand_fields: Annotated[
        list[str] | None,
        "List of fields in the response to be expanded for more detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetLinkedAccountsAccount'."]:
    """Retrieve details of a financial connections account.

    Use this tool to get detailed information about a specific financial connections account linked with Stripe. It should be called when account information is needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/linked_accounts/{account}".format(account=account_id),  # noqa: UP032
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_linked_account_owners(
    context: ToolContext,
    ownership_object_id: Annotated[
        str,
        "The unique ID of the ownership object to retrieve owners from. This is required to specify which account's owners to list.",  # noqa: E501
    ],
    linked_account_id: Annotated[
        str,
        "The unique identifier of the account to retrieve owners for. This is required to specify which account's owners you want to list.",  # noqa: E501
    ],
    pagination_ending_before: Annotated[
        str | None,
        "Cursor ID for pagination to fetch the previous page. Use the object ID from the start of the current list result.",  # noqa: E501
    ] = None,
    expanded_fields: Annotated[
        list[str] | None,
        "List of fields to be expanded in the response. Specify field names to include more data in the response.",  # noqa: E501
    ] = None,
    number_of_owners_to_return: Annotated[
        int | None,
        "Specify the number of account owners to retrieve, ranging from 1 to 100. Default is 10.",
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "Cursor for pagination to specify the starting point for the next page of results using an object ID.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetLinkedAccountsAccountOwners'."]:
    """Retrieve owners of a specific linked account.

    Use this tool to list all the owners associated with a specific account. This can be helpful for verifying account ownership or managing account permissions."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/linked_accounts/{account}/owners".format(  # noqa: UP032
                account=linked_account_id
            ),
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": expanded_fields,
                "limit": number_of_owners_to_return,
                "ownership": ownership_object_id,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_mandate_info(
    context: ToolContext,
    mandate_id: Annotated[
        str,
        "The unique identifier for the mandate to retrieve details for. It should be a valid string representing the mandate ID in Stripe.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields to expand in the response for more detailed information."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetMandatesMandate'."]:
    """Retrieve detailed information of a mandate.

    Fetches details about a Mandate object from Stripe when provided with a specific mandate ID."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/mandates/{mandate}".format(mandate=mandate_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def search_stripe_payment_intents(
    context: ToolContext,
    search_query_string: Annotated[
        str,
        "The search query to find specific PaymentIntents using Stripe's Search Query Language. Refer to the documentation for query syntax and fields.",  # noqa: E501
    ],
    expand_fields: Annotated[
        list[str] | None,
        "A list of specific fields in the response that should be expanded. Use field names as strings.",  # noqa: E501
    ] = None,
    result_limit: Annotated[
        int | None,
        "Number of PaymentIntent objects to return, ranging from 1 to 100, with a default of 10.",
    ] = None,
    pagination_cursor: Annotated[
        str | None,
        "Cursor for pagination. Use the 'next_page' value from a previous response to request more results.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetPaymentIntentsSearch'."]:
    """Search previously created Stripe PaymentIntents.

    Use this tool to search for PaymentIntents that you have previously created on Stripe using their Search Query Language. Note that search results might be slightly delayed, so avoid using this tool in scenarios needing strict consistency immediately after data changes."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/payment_intents/search",
            params=remove_none_values({
                "expand": expand_fields,
                "limit": result_limit,
                "page": pagination_cursor,
                "query": search_query_string,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_payment_intent_details(
    context: ToolContext,
    payment_intent_id: Annotated[
        str,
        "The unique identifier of the PaymentIntent to retrieve details for. Required to specify which PaymentIntent you are interested in.",  # noqa: E501
    ],
    payment_intent_client_secret: Annotated[
        str | None,
        "The client secret for the PaymentIntent, required when using a publishable key to retrieve the source.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None, "A list of fields to expand in the response for additional details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetPaymentIntentsIntent'."]:
    """Retrieve details of a specific PaymentIntent using its ID.

    Use this tool to get information about a PaymentIntent that has already been created. Suitable for retrieving details client-side with a publishable key."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/payment_intents/{intent}".format(  # noqa: UP032
                intent=payment_intent_id
            ),
            params=remove_none_values({
                "client_secret": payment_intent_client_secret,
                "expand": fields_to_expand,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_stripe_payment_links(
    context: ToolContext,
    pagination_ending_before: Annotated[
        str | None,
        "An object ID cursor to define the starting point in the list for pagination, retrieving the previous page.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response that should be expanded. Use field names as strings.",
    ] = None,
    object_return_limit: Annotated[
        int | None,
        "Specifies the maximum number of payment link objects to retrieve, ranging from 1 to 100. Default is 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "The object ID to define your place in the list for pagination. Use it to fetch the next page of payment links.",  # noqa: E501
    ] = None,
    include_active_payment_links: Annotated[
        bool | None,
        "Return active payment links only. Set to `false` to list inactive payment links.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetPaymentLinks'."]:
    """Retrieve a list of Stripe payment links.

    This tool calls the Stripe API to fetch a list of all your payment links. It should be used when you need to access or display your payment links managed through Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/payment_links",
            params=remove_none_values({
                "active": include_active_payment_links,
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "limit": object_return_limit,
                "starting_after": pagination_starting_after_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_payment_link_info(
    context: ToolContext,
    payment_link_id: Annotated[
        str, "The unique identifier of the payment link to retrieve details for."
    ],
    expand_fields: Annotated[
        list[str] | None, "List of fields to expand in the response for detailed information."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetPaymentLinksPaymentLink'."]:
    """Retrieve detailed information about a payment link.

    Use this tool to get information about a specific payment link from Stripe. It's useful for checking the status or details of payment links."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/payment_links/{payment_link}".format(  # noqa: UP032
                payment_link=payment_link_id
            ),
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_payment_link_line_items(
    context: ToolContext,
    payment_link_id: Annotated[
        str, "The unique identifier for the payment link whose line items need to be retrieved."
    ],
    pagination_ending_before: Annotated[
        str | None,
        "An object ID that serves as a pagination cursor to fetch the previous page of the list.",
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for more detailed information.",
    ] = None,
    item_limit: Annotated[
        int | None,
        "Specifies the maximum number of line items to retrieve, ranging from 1 to 100. Default is 10.",  # noqa: E501
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "An object ID used as a cursor to fetch the next page of the list when paginating. Use the ID of the last object from the previous response.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetPaymentLinksPaymentLinkLineItems'."
]:
    """Retrieve the line items for a specific payment link.

    Use this tool to get the line items associated with a specific payment link from Stripe. It provides the initial set of line items and a URL for the full list if needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/payment_links/{payment_link}/line_items".format(  # noqa: UP032
                payment_link=payment_link_id
            ),
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "limit": item_limit,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def list_payment_method_configurations(
    context: ToolContext,
    filter_by_connect_application: Annotated[
        str | None,
        "Specify the Connect application ID to filter the payment method configurations by.",
    ] = None,
    pagination_ending_before_id: Annotated[
        str | None,
        "Object ID that defines your place in the list for pagination, used to fetch the previous page.",  # noqa: E501
    ] = None,
    expand_fields: Annotated[
        list[str] | None,
        "List of fields in the response that should be expanded. Provide field names as strings in an array.",  # noqa: E501
    ] = None,
    max_results: Annotated[
        int | None,
        "Specify the maximum number of payment method configurations to be returned, ranging from 1 to 100. Defaults to 10 if not specified.",  # noqa: E501
    ] = None,
    pagination_starting_after_id: Annotated[
        str | None,
        "The object ID to define your place in the list for pagination, used to fetch the next page of results.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetPaymentMethodConfigurations'."]:
    """Retrieve available payment method configurations from Stripe.

    Use this tool to get a list of payment method configurations from the Stripe API. It should be called when you need to access the available configurations for payments."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/payment_method_configurations",
            params=remove_none_values({
                "application": filter_by_connect_application,
                "ending_before": pagination_ending_before_id,
                "expand": expand_fields,
                "limit": max_results,
                "starting_after": pagination_starting_after_id,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_payment_method_configuration(
    context: ToolContext,
    payment_method_configuration_id: Annotated[
        str, "The unique identifier for the payment method configuration to retrieve."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response to be expanded for more detailed information.",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetPaymentMethodConfigurationsConfiguration'."
]:
    """Retrieve a specific payment method configuration.

    This tool is used to get details about a specific payment method configuration from Stripe."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/payment_method_configurations/{configuration}".format(  # noqa: UP032
                configuration=payment_method_configuration_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def list_payment_method_domains(
    context: ToolContext,
    domain_name: Annotated[
        str | None,
        "Specify the domain name for the payment method domain object you want to represent.",
    ] = None,
    pagination_cursor_ending_before: Annotated[
        str | None,
        "A cursor ID to fetch the previous page of the payment method domain list in pagination.",
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to expand for more detailed information."
    ] = None,
    limit_number_of_returned_objects: Annotated[
        int | None,
        "Specify the number of payment method domains to return, ranging from 1 to 100. Default is 10.",  # noqa: E501
    ] = None,
    pagination_cursor_starting_after: Annotated[
        str | None, "An object ID cursor to fetch the next page in the list."
    ] = None,
    include_enabled_domains: Annotated[
        bool | None,
        "Include only enabled payment method domains in the results. If false, all domains will be included regardless of status.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetPaymentMethodDomains'."]:
    """Retrieve details of existing payment method domains.

    Use this tool to get a list of all payment method domains and their associated details. This can be helpful for managing or reviewing your payment configurations."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/payment_method_domains",
            params=remove_none_values({
                "domain_name": domain_name,
                "enabled": include_enabled_domains,
                "ending_before": pagination_cursor_ending_before,
                "expand": fields_to_expand,
                "limit": limit_number_of_returned_objects,
                "starting_after": pagination_cursor_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_payment_method_domain_details(
    context: ToolContext,
    payment_method_domain_id: Annotated[
        str, "The unique identifier of the payment method domain to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for additional details.",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetPaymentMethodDomainsPaymentMethodDomain'."
]:
    """Retrieve details of a specific payment method domain.

    This tool fetches information about a specified payment method domain. It should be called when details about an existing payment method domain are needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/payment_method_domains/{payment_method_domain}".format(  # noqa: UP032
                payment_method_domain=payment_method_domain_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_treasury_payment_methods(
    context: ToolContext,
    customer_id: Annotated[
        str | None,
        "The ID of the customer whose PaymentMethods will be retrieved for Treasury flows. This is used to filter the payment methods specific to a customer.",  # noqa: E501
    ] = None,
    pagination_ending_before: Annotated[
        str | None,
        "An object ID to fetch the previous page of the list in pagination. Use to navigate to earlier records.",  # noqa: E501
    ] = None,
    expand_response_fields: Annotated[
        list[str] | None,
        "Specifies which fields in the payment methods response should be expanded for more details.",  # noqa: E501
    ] = None,
    result_limit: Annotated[
        int | None,
        "The maximum number of payment methods to return, between 1 and 100. Default is 10.",
    ] = None,
    starting_after_payment_method: Annotated[
        str | None,
        "An object ID cursor to paginate through the list of payment methods. Use it to fetch the next page after a given object.",  # noqa: E501
    ] = None,
    filter_payment_method_type: Annotated[
        str | None,
        "Filter the list based on the payment method type. Use specific payment method values like 'card', 'paypal', etc., if expecting only one type.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetPaymentMethods'."]:
    """Retrieve a list of PaymentMethods for Treasury flows.

    This tool retrieves a list of PaymentMethods specifically for Treasury flows. It should be used when you want to access payment methods for these specific purposes, rather than customer-attached payment methods."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/payment_methods",
            params=remove_none_values({
                "customer": customer_id,
                "ending_before": pagination_ending_before,
                "expand": expand_response_fields,
                "limit": result_limit,
                "starting_after": starting_after_payment_method,
                "type": filter_payment_method_type,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_stripe_payment_method(
    context: ToolContext,
    payment_method_id: Annotated[
        str,
        "The unique identifier of the Stripe PaymentMethod to be retrieved. Required for fetching details of a specific payment method.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None, "A list of fields in the response to be expanded for additional details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetPaymentMethodsPaymentMethod'."]:
    """Retrieve details of a specific Stripe payment method.

    Use this tool to get information about a PaymentMethod object attached to a Stripe account. For payment methods attached to a customer, use the appropriate endpoint."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/payment_methods/{payment_method}".format(  # noqa: UP032
                payment_method=payment_method_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_stripe_payout_details(
    context: ToolContext,
    payout_id: Annotated[str, "The unique ID of the payout to retrieve details for from Stripe."],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the payout response to expand for more details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetPayoutsPayout'."]:
    """Retrieve details of a specific Stripe payout.

    This tool retrieves information about an existing payout from Stripe using the unique payout ID. It should be used when you need detailed information about a specific payout."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/payouts/{payout}".format(payout=payout_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_stripe_plan(
    context: ToolContext,
    plan_id: Annotated[str, "The unique identifier of the plan to be deleted in Stripe."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeletePlansPlan'."]:
    """Delete a specified plan from Stripe.

    Use this tool to delete a plan in Stripe, preventing new subscriptions to that plan while keeping existing subscribers unaffected."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/plans/{plan}".format(plan=plan_id),  # noqa: UP032
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_stripe_plan(
    context: ToolContext,
    stripe_plan_id: Annotated[
        str,
        "The unique identifier for the Stripe plan to retrieve details about. This is required to obtain a specific plan's information.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields to expand in the response for more detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetPlansPlan'."]:
    """Retrieve details of a specific Stripe plan by ID.

    Use this tool to get detailed information about a Stripe plan using its ID. It retrieves the plan's data directly from the Stripe service."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/plans/{plan}".format(plan=stripe_plan_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def search_stripe_prices(
    context: ToolContext,
    search_query_string: Annotated[
        str,
        "The search query string for prices using Stripe's Search Query Language. Refer to the documentation for syntax and supported fields.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response that should be expanded."
    ] = None,
    result_limit: Annotated[
        int | None,
        "Specifies the maximum number of price objects to return. Must be between 1 and 100, with a default of 10.",  # noqa: E501
    ] = None,
    pagination_cursor: Annotated[
        str | None,
        "Cursor for paginating through results. Omit on first call; use 'next_page' from a prior response for additional results.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetPricesSearch'."]:
    """Search for previously created Stripe prices.

    Use this tool to search for prices you have previously created on Stripe using the Stripe Search Query Language. Note that this function should not be used for read-after-write flows where strict consistency is necessary, as data may take some time to propagate."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/prices/search",
            params=remove_none_values({
                "expand": fields_to_expand,
                "limit": result_limit,
                "page": pagination_cursor,
                "query": search_query_string,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_stripe_price(
    context: ToolContext,
    price_id: Annotated[
        str, "The unique identifier for the price you want to retrieve from Stripe."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded to include additional details.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetPricesPrice'."]:
    """Fetches price details using a specific ID from Stripe.

    This tool retrieves detailed information about a price by its ID from the Stripe platform. It should be called when specific pricing information is needed for products or services managed via Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/prices/{price}".format(price=price_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def search_stripe_products(
    context: ToolContext,
    search_query_string: Annotated[
        str,
        "The search query string to find products. Refer to Stripe's Search Query Language for syntax and available fields.",  # noqa: E501
    ],
    response_fields_to_expand: Annotated[
        list[str] | None,
        "List of specific fields to expand in the response for detailed information. Use field names as strings.",  # noqa: E501
    ] = None,
    results_limit: Annotated[
        int | None,
        "Specifies the maximum number of product results to return, ranging from 1 to 100. Defaults to 10 if not set.",  # noqa: E501
    ] = None,
    pagination_cursor: Annotated[
        str | None,
        "A cursor for paginating through the results. Use the 'next_page' value from the previous response for subsequent pages. Do not include this on the first call.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetProductsSearch'."]:
    """Search for previously created products on Stripe.

    Use this tool to search for products you have created on Stripe. It utilizes Stripe's Search Query Language for querying. Note that the search may not be suitable for transactions needing strict consistency, as data may be slightly outdated. Also, this service isn't available in India."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/products/search",
            params=remove_none_values({
                "expand": response_fields_to_expand,
                "limit": results_limit,
                "page": pagination_cursor,
                "query": search_query_string,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_stripe_product(
    context: ToolContext,
    product_id_to_delete: Annotated[
        str,
        "The unique identifier of the product to delete. Ensure the product has no prices or SKUs associated with it.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteProductsId'."]:
    """Delete a product from Stripe if eligible.

    This tool deletes a product from Stripe, provided the product has no prices or SKUs associated with it. Use this to remove products when cleaning up a catalog or managing inventory."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/products/{id}".format(id=product_id_to_delete),  # noqa: UP032
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_product_details(
    context: ToolContext,
    product_id: Annotated[
        str,
        "The unique identifier for the product to retrieve details. Obtainable from product creation requests or product lists.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response to be expanded for more detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetProductsId'."]:
    """Retrieve details of a specific product by ID.

    Use this tool to get information about an existing product by providing its unique ID. This is useful for accessing product details from Stripe's catalog."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/products/{id}".format(id=product_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_product_features(
    context: ToolContext,
    product_id: Annotated[
        str,
        "The unique identifier of the product for which you want to retrieve features. This is a required field.",  # noqa: E501
    ],
    pagination_ending_cursor: Annotated[
        str | None,
        "An object ID that defines your position in the list for pagination, used to fetch the previous page.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for additional details.",
    ] = None,
    number_of_features_to_return: Annotated[
        int | None,
        "Specifies the number of product features to return. Must be between 1 and 100, with a default of 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "Cursor for pagination to fetch the next page of product features. Use the object ID from the last item on the previous page.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetProductsProductFeatures'."]:
    """Retrieve features for a specific product.

    Use this tool to obtain a list of features associated with a given product in Stripe. Ideal for when you need detailed information about a product's capabilities or offerings."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/products/{product}/features".format(product=product_id),  # noqa: UP032
            params=remove_none_values({
                "ending_before": pagination_ending_cursor,
                "expand": fields_to_expand,
                "limit": number_of_features_to_return,
                "starting_after": pagination_starting_after_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_product_feature(
    context: ToolContext,
    feature_id: Annotated[str, "The identifier of the feature to be deleted from the product."],
    product_id: Annotated[
        str,
        "The unique identifier of the product from which the feature is to be deleted. This is required to specify which product's feature should be removed.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteProductsProductFeaturesId'."]:
    """Delete a specific feature from a product.

    Use this tool to delete a feature attached to a specific product by providing the product and feature identifiers."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/products/{product}/features/{id}".format(  # noqa: UP032
                id=feature_id, product=product_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_product_feature_details(
    context: ToolContext,
    product_feature_id: Annotated[
        str, "The unique identifier of the product feature to retrieve details for."
    ],
    product_id: Annotated[str, "The unique identifier of the product associated with the feature."],
    fields_to_expand: Annotated[
        list[str] | None, "A list of fields in the response to expand for detailed information."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetProductsProductFeaturesId'."]:
    """Retrieve details of a feature attached to a product.

    Use this tool to obtain information about a specific feature associated with a product by providing the product and feature IDs."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/products/{product}/features/{id}".format(  # noqa: UP032
                id=product_feature_id, product=product_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_promotion_code_details(
    context: ToolContext,
    promotion_code_id: Annotated[
        str, "The unique identifier of the promotion code to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response to be expanded. Provide field names as strings.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetPromotionCodesPromotionCode'."]:
    """Retrieve details of a specific promotion code.

    This tool retrieves information about a promotion code using its ID. It can be used to access details such as discount amounts, expiration dates, and other relevant data tied to the specific promotion code."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/promotion_codes/{promotion_code}".format(  # noqa: UP032
                promotion_code=promotion_code_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_quotes_list(
    context: ToolContext,
    customer_id: Annotated[str | None, "The ID of the customer to retrieve quotes for."] = None,
    pagination_ending_before_cursor: Annotated[
        str | None,
        "A string cursor indicating the object ID before which results are returned for pagination purposes. Use it to fetch the previous page of the list.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields to expand in the response. Each field is specified as a string.",
    ] = None,
    result_limit: Annotated[
        int | None,
        "Sets the maximum number of quote objects to retrieve, between 1 and 100. Default is 10.",
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "Object ID for pagination to fetch the list after the specified item. Use to get the next page.",  # noqa: E501
    ] = None,
    quote_status: Annotated[
        str | None,
        "The status of the quote. Possible values are 'accepted', 'canceled', 'draft', or 'open'.",
    ] = None,
    test_clock_id: Annotated[
        str | None,
        "The ID of the test clock to filter quotes. Must be set with the customer parameter.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetQuotes'."]:
    """Fetches a list of your available quotes.

    Use this tool to retrieve a list of quotes you have created or received. It provides details on each quote you have within your Stripe account."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/quotes",
            params=remove_none_values({
                "customer": customer_id,
                "ending_before": pagination_ending_before_cursor,
                "expand": fields_to_expand,
                "limit": result_limit,
                "starting_after": pagination_starting_after,
                "status": quote_status,
                "test_clock": test_clock_id,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_quote_by_id(
    context: ToolContext,
    quote_id: Annotated[str, "The unique identifier of the quote to retrieve details for."],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to be expanded for additional details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetQuotesQuote'."]:
    """Fetches quote details using a specified ID.

    Use this tool to retrieve information about a specific quote by providing its ID."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/quotes/{quote}".format(quote=quote_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_upfront_quote_line_items(
    context: ToolContext,
    quote_id: Annotated[
        str,
        "The unique ID of the quote for which to retrieve upfront line items. This ID is required to specify the quote in context.",  # noqa: E501
    ],
    pagination_ending_before_id: Annotated[
        str | None,
        "A cursor indicating the last object ID to fetch the previous page in a paginated list of upfront line items.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields to expand in the response for more detailed information. Each entry should be a string representing a field.",  # noqa: E501
    ] = None,
    max_line_items_to_return: Annotated[
        int | None,
        "The maximum number of line items to retrieve, between 1 and 100. Default is 10.",
    ] = None,
    pagination_starting_object_id: Annotated[
        str | None,
        "An object ID used to fetch the next page of results in pagination, such as `obj_foo`.",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetQuotesQuoteComputedUpfrontLineItems'."
]:
    """Retrieve computed upfront line items from a quote.

    Use this tool to get the computed upfront line items for a specific quote from Stripe. Ideal for viewing details of the initial line items associated with a quote, including accessing a URL for the full list if needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/quotes/{quote}/computed_upfront_line_items".format(  # noqa: UP032
                quote=quote_id
            ),
            params=remove_none_values({
                "ending_before": pagination_ending_before_id,
                "expand": fields_to_expand,
                "limit": max_line_items_to_return,
                "starting_after": pagination_starting_object_id,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_quote_line_items(
    context: ToolContext,
    quote_identifier: Annotated[
        str, "The unique identifier of the quote whose line items are to be retrieved."
    ],
    pagination_cursor_ending_before: Annotated[
        str | None, "The object ID to define your place in the list for fetching the previous page."
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None, "List of field names to expand in the response for detailed information."
    ] = None,
    max_items_to_return: Annotated[
        int | None,
        "Specifies the maximum number of line items to return, ranging from 1 to 100. Defaults to 10 if not specified.",  # noqa: E501
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "The object ID to define your place in the list for pagination, used to fetch the next page after the specified object.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetQuotesQuoteLineItems'."]:
    """Fetch line items from a specified quote.

    Use this tool to retrieve a list of line items associated with a specific quote. This includes both a summary of the first few items and a URL for accessing the complete, paginated list."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/quotes/{quote}/line_items".format(  # noqa: UP032
                quote=quote_identifier
            ),
            params=remove_none_values({
                "ending_before": pagination_cursor_ending_before,
                "expand": fields_to_expand,
                "limit": max_items_to_return,
                "starting_after": pagination_starting_after_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def download_quote_pdf(
    context: ToolContext,
    quote_id: Annotated[
        str,
        "The unique identifier for the finalized quote to download as a PDF. This ID is required to retrieve the specific quote.",  # noqa: E501
    ],
    expand_fields: Annotated[
        list[str] | None,
        "A list of fields in the quote response that should be expanded for additional detail.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetQuotesQuotePdf'."]:
    """Download the PDF for a finalized Stripe quote.

    Use this tool to retrieve the PDF document for a completed quote from Stripe. It's useful when you need to obtain the finalized quote in PDF format for record-keeping or sharing purposes."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/quotes/{quote}/pdf".format(quote=quote_id),  # noqa: UP032
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_early_fraud_warning_details(
    context: ToolContext,
    early_fraud_warning_id: Annotated[
        str, "The unique identifier of the early fraud warning to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response that should be expanded for additional details.",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetRadarEarlyFraudWarningsEarlyFraudWarning'."
]:
    """Retrieve details of an early fraud warning.

    Fetches information about a previously created early fraud warning. Useful for examining potential fraudulent activity and understanding associated risks."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/radar/early_fraud_warnings/{early_fraud_warning}".format(  # noqa: UP032
                early_fraud_warning=early_fraud_warning_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def remove_radar_value_list_item(
    context: ToolContext,
    radar_value_list_item_id: Annotated[
        str,
        "The unique identifier of the ValueListItem to be removed from the Stripe Radar value list.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteRadarValueListItemsItem'."]:
    """Remove an item from a Stripe Radar value list.

    Use this tool to delete a specific ValueListItem from its parent value list in Stripe Radar."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/radar/value_list_items/{item}".format(  # noqa: UP032
                item=radar_value_list_item_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_value_list_item(
    context: ToolContext,
    value_list_item_id: Annotated[
        str, "The unique identifier of the ValueListItem to retrieve from Stripe's Radar service."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the ValueListItem response to expand for additional details.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetRadarValueListItemsItem'."]:
    """Retrieve details of a specific ValueListItem in Stripe Radar.

    This tool retrieves information about a specific ValueListItem object from Stripe's Radar service, which can be used to manage elements within its fraud prevention tools."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/radar/value_list_items/{item}".format(  # noqa: UP032
                item=value_list_item_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_stripe_value_list(
    context: ToolContext,
    value_list_id: Annotated[
        str,
        "The unique identifier of the ValueList to be deleted. Ensure it is not referenced in any rules before deletion.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteRadarValueListsValueList'."]:
    """Delete a Stripe Radar ValueList and its items.

    Use this tool to delete a specified ValueList object in Stripe Radar, along with all its contained items. Ensure the ValueList is not referenced in any rules before calling this tool."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/radar/value_lists/{value_list}".format(  # noqa: UP032
                value_list=value_list_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_radar_valuelist(
    context: ToolContext,
    identifier_of_radar_valuelist: Annotated[
        str,
        "The unique identifier of the Radar ValueList to retrieve details for. It is required to fetch the specific ValueList object.",  # noqa: E501
    ],
    expand_fields: Annotated[
        list[str] | None, "List of fields in the response to expand for additional details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetRadarValueListsValueList'."]:
    """Retrieve details of a specific Radar ValueList.

    Fetches information about a specified Radar ValueList object using its identifier."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/radar/value_lists/{value_list}".format(  # noqa: UP032
                value_list=identifier_of_radar_valuelist
            ),
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_refund_details(
    context: ToolContext,
    refund_id: Annotated[str, "The unique identifier of the refund to retrieve details for."],
    expand_fields: Annotated[
        list[str] | None,
        "Specify which fields in the response should be expanded. Provide an array of field paths.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetRefundsRefund'."]:
    """Retrieve details of an existing refund.

    Use this tool to obtain information about a specific refund by its identifier."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/refunds/{refund}".format(refund=refund_id),  # noqa: UP032
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_report_run_details(
    context: ToolContext,
    report_run_id: Annotated[
        str,
        "The unique identifier for the report run you want to retrieve details for. This ID is provided by Stripe when the report run is created.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields to expand in the response to include more detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetReportingReportRunsReportRun'."]:
    """Retrieve details of an existing report run.

    Use this tool to obtain specific information about a previously created report run in Stripe's reporting system."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/reporting/report_runs/{report_run}".format(  # noqa: UP032
                report_run=report_run_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_stripe_report_types(
    context: ToolContext,
    expand_fields: Annotated[
        list[str] | None,
        "A list of fields in the Stripe report types response to be expanded for more detailed information.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetReportingReportTypes'."]:
    """Retrieve a comprehensive list of Stripe report types.

    This tool calls the Stripe endpoint to return a full list of available Report Types. Use it when you need to know all report types that Stripe can generate."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/reporting/report_types",
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_stripe_report_type_details(
    context: ToolContext,
    stripe_report_type_id: Annotated[
        str, "The unique identifier for the Stripe Report Type to retrieve details about."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to expand for more detailed information."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetReportingReportTypesReportType'."
]:
    """Retrieve details for a specific Stripe Report Type.

    Use this tool to get detailed information about a specific Stripe Report Type. Some report types may require a live-mode API key."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/reporting/report_types/{report_type}".format(  # noqa: UP032
                report_type=stripe_report_type_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_review_details(
    context: ToolContext,
    review_identifier: Annotated[
        str,
        "The unique identifier of the review to be retrieved from Stripe. This is a required parameter.",  # noqa: E501
    ],
    expand_fields: Annotated[
        list[str] | None,
        "List of fields in the review response to be expanded for detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetReviewsReview'."]:
    """Retrieve details of a specific review on Stripe.

    This tool fetches the details of a particular review from Stripe, using the review's unique identifier."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/reviews/{review}".format(review=review_identifier),  # noqa: UP032
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_setup_intent_details(
    context: ToolContext,
    setup_intent_id: Annotated[str, "The unique identifier for the SetupIntent to be retrieved."],
    setup_intent_client_secret: Annotated[
        str | None,
        "The client secret for retrieving SetupIntent using a publishable key. Required for client-side retrieval.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields to expand in the response, such as nested objects. Each field should be specified as a string.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetSetupIntentsIntent'."]:
    """Fetch details of an existing Stripe SetupIntent.

    Use this tool to retrieve information about a specific SetupIntent created in Stripe. Requires the intent ID and optionally a client secret for client-side retrieval using a publishable key."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/setup_intents/{intent}".format(intent=setup_intent_id),  # noqa: UP032
            params=remove_none_values({
                "client_secret": setup_intent_client_secret,
                "expand": fields_to_expand,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_shipping_rate_details(
    context: ToolContext,
    shipping_rate_id: Annotated[
        str, "The unique identifier for the shipping rate to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields to expand in the response for more detailed information."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetShippingRatesShippingRateToken'."
]:
    """Retrieve details of a specific shipping rate using its ID.

    This tool retrieves the shipping rate object associated with the provided shipping rate ID. Call this tool to get detailed information about a particular shipping rate from Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/shipping_rates/{shipping_rate_token}".format(  # noqa: UP032
                shipping_rate_token=shipping_rate_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_scheduled_query_runs(
    context: ToolContext,
    pagination_cursor_ending_before: Annotated[
        str | None, "A cursor object ID for pagination to fetch the previous page of the list."
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None, "A list of fields in the response that should be expanded."
    ] = None,
    object_limit: Annotated[
        int | None, "Specify the number of objects to return, between 1 and 100. Default is 10."
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "Cursor for pagination, to fetch the next page starting after the specified object ID.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetSigmaScheduledQueryRuns'."]:
    """Retrieve a list of scheduled query runs from Stripe.

    Use this tool to get information on scheduled query runs managed by Stripe's Sigma service. It retrieves a list of all the scheduled query runs that have occurred."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/sigma/scheduled_query_runs",
            params=remove_none_values({
                "ending_before": pagination_cursor_ending_before,
                "expand": fields_to_expand,
                "limit": object_limit,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_scheduled_query_run_details(
    context: ToolContext,
    scheduled_query_run_id: Annotated[
        str, "The unique identifier for the scheduled query run you wish to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for additional detail.",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetSigmaScheduledQueryRunsScheduledQueryRun'."
]:
    """Fetches details of a Stripe Sigma scheduled query run.

    This tool retrieves the details of a specific scheduled query run from Stripe Sigma. Use this when you need information about the execution of a scheduled query run."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/sigma/scheduled_query_runs/{scheduled_query_run}".format(  # noqa: UP032
                scheduled_query_run=scheduled_query_run_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_stripe_source(
    context: ToolContext,
    stripe_source_id: Annotated[
        str,
        "The unique identifier of the Stripe source object to retrieve its current information.",
    ],
    source_client_secret: Annotated[
        str | None,
        "The client secret of the source. Required if a publishable key is used to retrieve the source.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to be expanded for additional details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetSourcesSource'."]:
    """Retrieve updated details of a Stripe source object.

    This tool should be called when you need to get the current information of a specific source object in Stripe using its unique source ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/sources/{source}".format(source=stripe_source_id),  # noqa: UP032
            params=remove_none_values({
                "client_secret": source_client_secret,
                "expand": fields_to_expand,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_source_mandate_notification(
    context: ToolContext,
    mandate_notification_id: Annotated[
        str, "The unique identifier of the mandate notification to retrieve details for."
    ],
    source_id: Annotated[
        str,
        "The unique identifier of the source to retrieve information for. This is required to specify which source's mandate notification you want to access.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response that should be expanded for additional details.",
    ] = None,
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'GetSourcesSourceMandateNotificationsMandateNotification'.",
]:
    """Retrieve details of a specific mandate notification.

    This tool retrieves information about a specific Source MandateNotification from Stripe. It should be used when you need to access details regarding a mandate notification for a given source."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/sources/{source}/mandate_notifications/{mandate_notification}".format(  # noqa: UP032
                mandate_notification=mandate_notification_id, source=source_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_source_transactions(
    context: ToolContext,
    source_id: Annotated[
        str,
        "The unique identifier of the source to retrieve transactions for. Required to specify the target of the retrieval.",  # noqa: E501
    ],
    pagination_ending_before: Annotated[
        str | None,
        "An object ID for pagination to fetch the previous page of the list. Use the ID of the first object from the current list.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of field names in the response that should be expanded for detailed information.",
    ] = None,
    transaction_limit: Annotated[
        int | None,
        "Maximum number of transactions to return. Must be between 1 and 100, default is 10.",
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "An object ID used as a cursor to fetch the next page of the list. Use this to continue listing transactions after a known last object ID.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetSourcesSourceSourceTransactions'."
]:
    """Retrieve transactions for a specific source.

    Use this tool to list all transactions associated with a specific source in Stripe. It should be called when transaction details for a given source are needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/sources/{source}/source_transactions".format(  # noqa: UP032
                source=source_id
            ),
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "limit": transaction_limit,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_stripe_source_transaction(
    context: ToolContext,
    source_id: Annotated[
        str,
        "The unique ID of the Stripe source. Use this to specify which source's transaction to retrieve.",  # noqa: E501
    ],
    stripe_source_transaction_id: Annotated[
        str,
        "The unique identifier for the source transaction to retrieve from Stripe. This ID is obtained from previous source creation requests.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "An array of strings specifying which fields in the response should be expanded.",
    ] = None,
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'GetSourcesSourceSourceTransactionsSourceTransaction'.",
]:
    """Retrieve a Stripe source transaction by ID.

    Fetches information of an existing source transaction using the source ID and transaction ID from Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/sources/{source}/source_transactions/{source_transaction}".format(  # noqa: UP032
                source=source_id, source_transaction=stripe_source_transaction_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_subscription_items(
    context: ToolContext,
    subscription_id: Annotated[
        str, "The unique identifier of the subscription to retrieve its items."
    ],
    pagination_ending_before: Annotated[
        str | None, "Object ID for pagination to fetch the previous page of subscription items."
    ] = None,
    expand_fields: Annotated[
        list[str] | None,
        "List of fields in the response to be expanded. Specify each field as a string.",
    ] = None,
    max_items_to_return: Annotated[
        int | None,
        "Specify the number of subscription items to return, ranging from 1 to 100. Defaults to 10.",  # noqa: E501
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "A cursor object ID to define your place for pagination, fetching the next page of the list.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetSubscriptionItems'."]:
    """Retrieve subscription items for a subscription.

    This tool returns a list of subscription items associated with a specified subscription. It should be called when there's a need to view or manage the items within a specific subscription."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/subscription_items",
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": expand_fields,
                "limit": max_items_to_return,
                "starting_after": pagination_starting_after,
                "subscription": subscription_id,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_subscription_item(
    context: ToolContext,
    subscription_item_id: Annotated[
        str, "The unique identifier of the subscription item to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response to be expanded for detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetSubscriptionItemsItem'."]:
    """Retrieve details of a specific subscription item.

    This tool retrieves information about a subscription item using its ID. It can be used to access the specifics of a subscription item within a subscription plan to understand its configuration and parameters."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/subscription_items/{item}".format(  # noqa: UP032
                item=subscription_item_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_subscription_schedule(
    context: ToolContext,
    subscription_schedule_id: Annotated[
        str, "The unique identifier for the subscription schedule to retrieve details for."
    ],
    fields_to_expand_in_response: Annotated[
        list[str] | None, "A list of fields to expand in the response for additional details."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetSubscriptionSchedulesSchedule'."
]:
    """Get details of an existing subscription schedule by ID.

    This tool retrieves the detailed information of an existing subscription schedule using its unique identifier. It should be called when detailed information about a subscription schedule is needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/subscription_schedules/{schedule}".format(  # noqa: UP032
                schedule=subscription_schedule_id
            ),
            params=remove_none_values({"expand": fields_to_expand_in_response}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def search_stripe_subscriptions(
    context: ToolContext,
    search_query_string: Annotated[
        str,
        "The search query string used to filter Stripe subscriptions. Refer to the Stripe Search Query Language documentation for syntax and query fields.",  # noqa: E501
    ],
    expand_fields: Annotated[
        list[str] | None,
        "A list of fields in the Stripe subscription response to be expanded. This allows accessing additional data for each subscription object.",  # noqa: E501
    ] = None,
    result_limit: Annotated[
        int | None,
        "Specify the maximum number of subscription results to return, from 1 to 100. Default is 10.",  # noqa: E501
    ] = None,
    pagination_cursor: Annotated[
        str | None,
        "Cursor for paginating through results. Omit on first call; use next_page value from a prior response for subsequent results.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetSubscriptionsSearch'."]:
    """Search previously created Stripe subscriptions.

    Use this tool to search for subscriptions created with Stripe using their Search Query Language. This is ideal for retrieving subscription data, but not suitable for scenarios requiring strict consistency, such as immediately after creating or updating data. Note: This functionality isn't available for merchants in India."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/subscriptions/search",
            params=remove_none_values({
                "expand": expand_fields,
                "limit": result_limit,
                "page": pagination_cursor,
                "query": search_query_string,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_subscription_details(
    context: ToolContext,
    subscription_id: Annotated[
        str,
        "The ID of the subscription to retrieve details for. It is required to fetch the subscription information.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the subscription response to be expanded for detailed information.",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetSubscriptionsSubscriptionExposedId'."
]:
    """Retrieve details of a subscription by its ID.

    This tool is used to fetch details about a specific subscription using its exposed ID. It should be called when subscription information is needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/subscriptions/{subscription_exposed_id}".format(  # noqa: UP032
                subscription_exposed_id=subscription_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def remove_subscription_discount(
    context: ToolContext,
    subscription_id: Annotated[
        str, "The unique identifier for the subscription from which the discount will be removed."
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'DeleteSubscriptionsSubscriptionExposedIdDiscount'.",
]:
    """Remove the discount from a subscription.

    This tool should be called to remove the currently applied discount on a given subscription in the Stripe service."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/subscriptions/{subscription_exposed_id}/discount".format(  # noqa: UP032
                subscription_exposed_id=subscription_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_tax_calculation(
    context: ToolContext,
    tax_calculation_id: Annotated[
        str, "The unique identifier for the Tax Calculation object to retrieve."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields to expand in the response. Use to get detailed subfields of tax calculations.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTaxCalculationsCalculation'."]:
    """Retrieve a specific tax calculation by its ID.

    This tool retrieves details of a Tax Calculation object using its unique ID, provided the calculation has not expired. It is useful for obtaining information on specific tax calculations."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/tax/calculations/{calculation}".format(  # noqa: UP032
                calculation=tax_calculation_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_tax_calculation_line_items(
    context: ToolContext,
    tax_calculation_id: Annotated[
        str,
        "The ID of the tax calculation to retrieve line items for. Ensure that the calculation has not expired.",  # noqa: E501
    ],
    pagination_cursor_ending_before: Annotated[
        str | None,
        "An object ID to define your place in the list for pagination, used to fetch the previous page.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response to be expanded. Use this to include additional data in the output.",  # noqa: E501
    ] = None,
    object_return_limit: Annotated[
        int | None, "Specifies the number of objects to return, between 1 and 100. Default is 10."
    ] = None,
    pagination_starting_after_item_id: Annotated[
        str | None, "An object ID used for pagination to fetch the next page of results."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetTaxCalculationsCalculationLineItems'."
]:
    """Retrieve line items for a Stripe tax calculation.

    Use this tool to get the line items of a tax calculation from Stripe, provided the calculation hasn't expired."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/tax/calculations/{calculation}/line_items".format(  # noqa: UP032
                calculation=tax_calculation_id
            ),
            params=remove_none_values({
                "ending_before": pagination_cursor_ending_before,
                "expand": fields_to_expand,
                "limit": object_return_limit,
                "starting_after": pagination_starting_after_item_id,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_tax_registrations(
    context: ToolContext,
    pagination_ending_before: Annotated[
        str | None,
        "An object ID used as a cursor to define your position in the list for pagination. Use this to fetch the previous page of objects.",  # noqa: E501
    ] = None,
    response_fields_to_expand: Annotated[
        list[str] | None,
        "List of fields to be expanded in the response, allowing for detailed information retrieval.",  # noqa: E501
    ] = None,
    object_limit: Annotated[
        int | None,
        "Specifies the number of tax registration objects to return, ranging from 1 to 100. Defaults to 10 if not specified.",  # noqa: E501
    ] = None,
    pagination_starting_after_object_id: Annotated[
        str | None,
        "A cursor for pagination. Use the object ID to fetch the next page of the list when applicable.",  # noqa: E501
    ] = None,
    tax_registration_status: Annotated[
        str | None,
        "Specifies the status of the tax registration. Options: active, all, expired, scheduled.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTaxRegistrations'."]:
    """Retrieve a list of tax registration objects from Stripe.

    Use this tool to get detailed information about tax registrations on Stripe. It returns a list of registration objects that are currently registered."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/tax/registrations",
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": response_fields_to_expand,
                "limit": object_limit,
                "starting_after": pagination_starting_after_object_id,
                "status": tax_registration_status,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_tax_registration_info(
    context: ToolContext,
    registration_id: Annotated[
        str,
        "The unique identifier for the tax registration. Provide this to retrieve specific registration details.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded to provide more detailed information.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTaxRegistrationsId'."]:
    """Retrieve details of a specific tax registration.

    Use this tool to obtain information about a specific tax registration by providing the registration ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/tax/registrations/{id}".format(id=registration_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_tax_settings(
    context: ToolContext,
    expand_fields: Annotated[
        list[str] | None,
        "A list of field names in the response to expand for more detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTaxSettings'."]:
    """Retrieve merchant tax settings in Stripe.

    This tool fetches the tax settings for a merchant from Stripe, providing detailed information about tax configurations."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/tax/settings",
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_tax_transaction(
    context: ToolContext,
    transaction_id: Annotated[str, "Unique identifier for the tax transaction to retrieve."],
    expand_response_fields: Annotated[
        list[str] | None,
        "A list of fields to expand in the tax transaction response for additional details.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTaxTransactionsTransaction'."]:
    """Retrieve details of a specific tax transaction.

    This tool retrieves a Tax Transaction object from the Stripe API, providing detailed information about a specific tax transaction."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/tax/transactions/{transaction}".format(  # noqa: UP032
                transaction=transaction_id
            ),
            params=remove_none_values({"expand": expand_response_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_transaction_line_items(
    context: ToolContext,
    transaction_id: Annotated[
        str,
        "The unique identifier for the transaction. Use this to retrieve its line items from Stripe.",  # noqa: E501
    ],
    pagination_ending_id: Annotated[
        str | None,
        "Cursor ID for paginating backwards to fetch the previous page of transaction line items.",
    ] = None,
    expand_fields: Annotated[
        list[str] | None,
        "Specify which response fields to expand. Provide an array of strings with field names.",
    ] = None,
    number_of_items_to_return: Annotated[
        int | None,
        "Specifies the number of line items to return, between 1 and 100. Defaults to 10 if not specified.",  # noqa: E501
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "A cursor ID for pagination to fetch the next page of the list. Use the last object's ID from the current page.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetTaxTransactionsTransactionLineItems'."
]:
    """Retrieve line items for a specified transaction.

    Use this tool to get the line items of a committed standalone transaction from Stripe as a collection."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/tax/transactions/{transaction}/line_items".format(  # noqa: UP032
                transaction=transaction_id
            ),
            params=remove_none_values({
                "ending_before": pagination_ending_id,
                "expand": expand_fields,
                "limit": number_of_items_to_return,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_tax_codes_list(
    context: ToolContext,
    pagination_cursor_ending_before: Annotated[
        str | None,
        "A cursor (object ID) to fetch the previous page of the tax codes list in pagination. Use to define your place in the list when stepping backwards.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "Specifies which fields in the tax codes response should be expanded for more detailed information.",  # noqa: E501
    ] = None,
    object_return_limit: Annotated[
        int | None,
        "Set the maximum number of tax codes to return, ranging from 1 to 100, with a default of 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "An object ID used as a cursor to fetch the next page of the list. Use it for pagination to continue from the last retrieved item.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTaxCodes'."]:
    """Retrieve all available tax codes for products from Stripe.

    Use this tool to get a list of all tax codes that can be added to products for specific tax calculations in Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/tax_codes",
            params=remove_none_values({
                "ending_before": pagination_cursor_ending_before,
                "expand": fields_to_expand,
                "limit": object_return_limit,
                "starting_after": pagination_starting_after_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_tax_code_details(
    context: ToolContext,
    tax_code_id: Annotated[
        str,
        "The unique ID of the tax code to retrieve. Use this to fetch specific tax code details from Stripe.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields to be expanded in the response."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTaxCodesId'."]:
    """Retrieve details for a specific tax code by ID.

    This tool fetches information about an existing tax code using its unique ID. It's useful for obtaining detailed tax code data from Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/tax_codes/{id}".format(id=tax_code_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_tax_id(
    context: ToolContext,
    tax_id: Annotated[
        str,
        "The identifier of the tax ID to be deleted. This should be the specific tax ID string associated with an account or customer in Stripe.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteTaxIdsId'."]:
    """Delete a tax ID from an account or customer.

    Use this tool to delete an existing tax ID associated with an account or customer in Stripe."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/tax_ids/{id}".format(id=tax_id),  # noqa: UP032
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_tax_id(
    context: ToolContext,
    tax_id_identifier: Annotated[
        str,
        "The unique identifier for the tax_id object to be retrieved. This is a required field to specify which tax_id you want information about.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response that should be expanded for detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTaxIdsId'."]:
    """Retrieve an account or customer's tax_id object.

    Use this tool to retrieve detailed information about a specific tax_id associated with an account or customer on Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/tax_ids/{id}".format(id=tax_id_identifier),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_tax_rate(
    context: ToolContext,
    tax_rate_id: Annotated[
        str,
        "The unique identifier for the tax rate to be retrieved from Stripe. This ID is required to fetch the specific tax rate details.",  # noqa: E501
    ],
    expand_fields: Annotated[
        list[str] | None,
        "A list of fields to be expanded in the response. This allows you to retrieve additional nested information related to the tax rate.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTaxRatesTaxRate'."]:
    """Fetches a tax rate by its ID from Stripe.

    Use this tool to retrieve specific tax rate information from Stripe using the tax rate ID. It provides the details associated with the particular tax rate."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/tax_rates/{tax_rate}".format(tax_rate=tax_rate_id),  # noqa: UP032
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_terminal_configurations(
    context: ToolContext,
    pagination_ending_before: Annotated[
        str | None,
        "A string cursor for pagination to fetch the previous page, defined by an object ID.",
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to expand for additional details."
    ] = None,
    maximum_objects_to_return: Annotated[
        int | None,
        "Set the maximum number of terminal Configuration objects to retrieve, ranging from 1 to 100. Default is 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_id: Annotated[
        str | None,
        "An object ID for pagination, defining the start position for the next page of the list. Use this to continue listing from a specific object.",  # noqa: E501
    ] = None,
    only_return_account_default_configurations: Annotated[
        bool | None,
        "If true, only return the account default configurations; if false, return non-default configurations.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTerminalConfigurations'."]:
    """Retrieve a list of terminal Configuration objects.

    Call this tool to obtain a list of Stripe terminal configurations. It retrieves all available Configuration objects used by terminals."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/terminal/configurations",
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "is_account_default": only_return_account_default_configurations,
                "limit": maximum_objects_to_return,
                "starting_after": pagination_starting_after_id,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_terminal_configuration(
    context: ToolContext,
    configuration_id_to_delete: Annotated[
        str, "The ID of the terminal configuration you want to delete from Stripe."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'DeleteTerminalConfigurationsConfiguration'."
]:
    """Deletes a terminal configuration.

    Use this tool to delete a specific terminal configuration in Stripe by providing the configuration ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/terminal/configurations/{configuration}".format(  # noqa: UP032
                configuration=configuration_id_to_delete
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_terminal_configuration(
    context: ToolContext,
    configuration_id: Annotated[
        str, "The unique identifier of the terminal configuration to retrieve."
    ],
    expand_fields: Annotated[
        list[str] | None,
        "A list of fields in the terminal configuration response that should be expanded for more details.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetTerminalConfigurationsConfiguration'."
]:
    """Retrieves a terminal configuration object for Stripe."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/terminal/configurations/{configuration}".format(  # noqa: UP032
                configuration=configuration_id
            ),
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_terminal_locations(
    context: ToolContext,
    pagination_ending_before_cursor: Annotated[
        str | None,
        "The object ID to define your place in pagination, used to fetch the previous page of the list.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields to expand in the response for more detailed information.",
    ] = None,
    results_limit: Annotated[
        int | None,
        "The maximum number of terminal location objects to return. Acceptable values are between 1 and 100; default is 10.",  # noqa: E501
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "A cursor indicating the position in the list to start fetching the next set of terminal locations. Use this with the object ID received at the end of the previous page.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTerminalLocations'."]:
    """Retrieve a list of terminal location objects from Stripe.

    This tool calls the Stripe API to fetch a list of terminal location objects. It should be used when you need information about available terminal locations."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/terminal/locations",
            params=remove_none_values({
                "ending_before": pagination_ending_before_cursor,
                "expand": fields_to_expand,
                "limit": results_limit,
                "starting_after": pagination_starting_after,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_terminal_location(
    context: ToolContext,
    location_identifier: Annotated[
        str, "The unique identifier of the terminal location to delete."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteTerminalLocationsLocation'."]:
    """Deletes a specified terminal location in Stripe.

    Use this tool to delete a specific terminal location in Stripe by providing the location identifier. It removes the location object from the terminal services."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/terminal/locations/{location}".format(  # noqa: UP032
                location=location_identifier
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_terminal_location(
    context: ToolContext,
    location_id: Annotated[
        str, "The unique identifier for the terminal location to retrieve information for."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields in the response to expand for additional details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTerminalLocationsLocation'."]:
    """Fetches details of a terminal location by ID.

    Use this tool to obtain information about a specific terminal location from Stripe by providing the location ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/terminal/locations/{location}".format(  # noqa: UP032
                location=location_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_terminal_readers(
    context: ToolContext,
    filter_by_device_type: Annotated[
        str | None,
        "Specify the type of device to filter terminal readers. Options include: 'bbpos_chipper2x', 'bbpos_wisepad3', 'bbpos_wisepos_e', 'mobile_phone_reader', 'simulated_stripe_s700', 'simulated_wisepos_e', 'stripe_m2', 'stripe_s700', 'verifone_P400'.",  # noqa: E501
    ] = None,
    pagination_cursor_ending_before: Annotated[
        str | None, "A cursor for pagination, used to fetch the previous page based on object ID."
    ] = None,
    expand_response_fields: Annotated[
        list[str] | None, "List of fields to expand in the response, specified as strings."
    ] = None,
    object_return_limit: Annotated[
        int | None,
        "Specifies the maximum number of terminal reader objects to return, ranging from 1 to 100. Default is 10.",  # noqa: E501
    ] = None,
    filter_by_location_id: Annotated[
        str | None, "Specify the location ID to filter readers to a specific location only."
    ] = None,
    filter_by_serial_number: Annotated[
        str | None,
        "Provide a serial number to filter the list of terminal readers by this specific serial number.",  # noqa: E501
    ] = None,
    pagination_start_object_id: Annotated[
        str | None,
        "The object ID used as a cursor to define your starting point in the list for pagination, fetching the next page.",  # noqa: E501
    ] = None,
    filter_by_status: Annotated[
        str | None, "Filter terminal readers by their status, either 'offline' or 'online'."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTerminalReaders'."]:
    """Retrieve a list of terminal reader objects.

    Use this tool to obtain a list of Stripe terminal readers. It is useful when you need to manage or view details of connected terminal devices."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/terminal/readers",
            params=remove_none_values({
                "device_type": filter_by_device_type,
                "ending_before": pagination_cursor_ending_before,
                "expand": expand_response_fields,
                "limit": object_return_limit,
                "location": filter_by_location_id,
                "serial_number": filter_by_serial_number,
                "starting_after": pagination_start_object_id,
                "status": filter_by_status,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_terminal_reader(
    context: ToolContext,
    terminal_reader_id: Annotated[
        str, "The ID of the terminal reader to be deleted from the Stripe account."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'DeleteTerminalReadersReader'."]:
    """Delete a terminal reader from the Stripe account.

    This tool is used to delete a terminal reader object in a Stripe account. It should be called when there is a need to remove a specific reader."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/terminal/readers/{reader}".format(  # noqa: UP032
                reader=terminal_reader_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_terminal_reader(
    context: ToolContext,
    terminal_reader_id: Annotated[
        str,
        "The unique identifier for the terminal reader to retrieve. It should be a string value.",
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for more detail.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTerminalReadersReader'."]:
    """Retrieve details of a terminal reader.

    This tool retrieves a specific terminal reader object from the Stripe API. It should be called when detailed information about a particular reader is needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/terminal/readers/{reader}".format(  # noqa: UP032
                reader=terminal_reader_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_test_clocks_list(
    context: ToolContext,
    pagination_cursor_ending_before: Annotated[
        str | None,
        "A cursor ID for pagination to fetch the previous page of the list. Use an object ID.",
    ] = None,
    expand_response_fields: Annotated[
        list[str] | None,
        "List of fields to expand in the response. Specify fields you want expanded for more details.",  # noqa: E501
    ] = None,
    number_of_objects_limit: Annotated[
        int | None,
        "Specify the number of test clocks to return, between 1 and 100, with a default of 10.",
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "An object ID for pagination. Use this ID to fetch the next page of the list of test clocks.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTestHelpersTestClocks'."]:
    """Retrieve a list of your test clocks from Stripe.

    Use this tool to obtain a list of test clocks for testing purposes in Stripe environments."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/test_helpers/test_clocks",
            params=remove_none_values({
                "ending_before": pagination_cursor_ending_before,
                "expand": expand_response_fields,
                "limit": number_of_objects_limit,
                "starting_after": pagination_starting_after_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_test_clock(
    context: ToolContext,
    test_clock_id: Annotated[
        str, "The unique identifier of the test clock to be deleted from Stripe's test environment."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'DeleteTestHelpersTestClocksTestClock'."
]:
    """Deletes a test clock in Stripe's test environment.

    This tool is used to delete a specific test clock from Stripe's test environment. Call this tool when you need to remove a test clock that is no longer needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/test_helpers/test_clocks/{test_clock}".format(  # noqa: UP032
                test_clock=test_clock_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_test_clock(
    context: ToolContext,
    test_clock_id: Annotated[
        str, "The unique identifier of the test clock to retrieve from Stripe."
    ],
    expand_fields: Annotated[
        list[str] | None,
        "A list of strings specifying which fields in the response should be expanded for additional details.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetTestHelpersTestClocksTestClock'."
]:
    """Retrieve details of a Stripe test clock.

    This tool retrieves information about a specific test clock within Stripe's test environment. It should be used to gather details about test clocks for testing purposes."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/test_helpers/test_clocks/{test_clock}".format(  # noqa: UP032
                test_clock=test_clock_id
            ),
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_stripe_token(
    context: ToolContext,
    stripe_token_id: Annotated[
        str, "The ID of the Stripe token you want to retrieve details about."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for more detail.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTokensToken'."]:
    """Retrieve details of a Stripe token using its ID.

    Use this tool to fetch information about a specific Stripe token by providing its ID."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/tokens/{token}".format(token=stripe_token_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_stripe_topup_details(
    context: ToolContext,
    topup_id: Annotated[
        str, "The unique ID of the Stripe top-up you want to retrieve details for."
    ],
    expand_fields: Annotated[
        list[str] | None,
        "A list of fields in the response to be expanded. Specify field names as strings.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTopupsTopup'."]:
    """Retrieve details of a Stripe top-up using its ID.

    This tool retrieves the details of a previously created Stripe top-up. It requires the unique top-up ID and returns the corresponding top-up information."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/topups/{topup}".format(topup=topup_id),  # noqa: UP032
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_transfer_reversals(
    context: ToolContext,
    transfer_id: Annotated[
        str, "The unique identifier of the transfer for which to retrieve reversals."
    ],
    pagination_ending_before: Annotated[
        str | None, "An object ID cursor to navigate to the previous page in the list of reversals."
    ] = None,
    expand_fields_in_response: Annotated[
        list[str] | None, "List of response fields to expand in the results for detailed data."
    ] = None,
    fetch_limit: Annotated[
        int | None,
        "Set the maximum number of reversal objects to return, ranging from 1 to 100. Default is 10.",  # noqa: E501
    ] = None,
    pagination_start_cursor: Annotated[
        str | None,
        "The object ID to define your place in the list for pagination. Use this to fetch the next page, starting after the given object ID.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTransfersIdReversals'."]:
    """Retrieve reversals of a specific transfer.

    Use this tool to get a list of reversals for a specific transfer in Stripe. This is useful when more than the 10 most recent reversals are needed, allowing pagination using limit and starting_after parameters."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/transfers/{id}/reversals".format(id=transfer_id),  # noqa: UP032
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": expand_fields_in_response,
                "limit": fetch_limit,
                "starting_after": pagination_start_cursor,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_transfer_details(
    context: ToolContext,
    transfer_id: Annotated[
        str,
        "The unique identifier for the transfer you want to retrieve details about. This ID is obtained from a transfer creation request or the transfer list.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the transfer response to expand for more detailed information.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTransfersTransfer'."]:
    """Retrieve details of an existing transfer using its ID.

    Use this tool to fetch information about a specific transfer by providing its unique ID from a previous request or list."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/transfers/{transfer}".format(transfer=transfer_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_specific_transfer_reversal_details(
    context: ToolContext,
    reversal_id: Annotated[
        str, "The unique identifier of the transfer reversal to retrieve details for."
    ],
    transfer_id: Annotated[
        str,
        "The unique identifier for the transfer to retrieve reversal details from. This is required to specify which transfer you're inquiring about.",  # noqa: E501
    ],
    expand_fields: Annotated[
        list[str] | None, "List of fields in the response to be expanded for detailed information."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTransfersTransferReversalsId'."]:
    """Retrieve details about a specific transfer reversal.

    This tool retrieves details of a specific reversal associated with a transfer. Use it to access more than the 10 most recent reversals or to obtain specific information about a particular reversal."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/transfers/{transfer}/reversals/{id}".format(  # noqa: UP032
                id=reversal_id, transfer=transfer_id
            ),
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_credit_reversals(
    context: ToolContext,
    financial_account_id: Annotated[
        str, "The ID of the FinancialAccount associated with the CreditReversals to be returned."
    ],
    pagination_ending_before: Annotated[
        str | None, "A cursor object ID for pagination to fetch the previous list page."
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields to be expanded in the response for detailed information.",
    ] = None,
    max_objects_returned: Annotated[
        int | None,
        "Sets the maximum number of credit reversals to be returned. Valid range is 1 to 100, defaulting to 10.",  # noqa: E501
    ] = None,
    filter_by_received_credit_id: Annotated[
        str | None,
        "Filter Credit Reversals to only include those associated with the specified ReceivedCredit ID.",  # noqa: E501
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None, "An object ID used to fetch the next page of the list in a paginated response."
    ] = None,
    credit_reversal_status: Annotated[
        str | None,
        "Filter CreditReversals based on their status. Possible values are: canceled, posted, processing.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTreasuryCreditReversals'."]:
    """Retrieve a list of Credit Reversals from Stripe's Treasury.

    This tool fetches a list of Credit Reversals from Stripe's Treasury endpoint. It should be used when detailed information about credit reversals is needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/credit_reversals",
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": fields_to_expand,
                "financial_account": financial_account_id,
                "limit": max_objects_returned,
                "received_credit": filter_by_received_credit_id,
                "starting_after": pagination_starting_after_cursor,
                "status": credit_reversal_status,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_credit_reversal_details(
    context: ToolContext,
    credit_reversal_id: Annotated[
        str,
        "The unique ID of the CreditReversal to retrieve details for. This ID is obtained from the CreditReversal creation request or list.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for more detailed information.",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetTreasuryCreditReversalsCreditReversal'."
]:
    """Retrieve details of a specific CreditReversal using its ID.

    Use this tool to fetch information about an existing CreditReversal by providing its unique ID. Ideal for confirming details or reviewing the status of a CreditReversal transaction."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/credit_reversals/{credit_reversal}".format(  # noqa: UP032
                credit_reversal=credit_reversal_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_debit_reversals_list(
    context: ToolContext,
    financial_account_id: Annotated[
        str, "The ID of the FinancialAccount to retrieve associated debit reversals."
    ],
    pagination_ending_before_cursor: Annotated[
        str | None,
        "A cursor object ID for pagination. Use this to fetch the previous page of the list.",
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of fields in the response to expand for obtaining additional nested information.",
    ] = None,
    max_number_of_debit_reversals: Annotated[
        int | None,
        "The maximum number of debit reversals to return. Must be between 1 and 100. Defaults to 10 if not specified.",  # noqa: E501
    ] = None,
    filter_by_received_debit_id: Annotated[
        str | None,
        "The ID of the ReceivedDebit to filter debit reversals by. Only returns reversals for this specific ID.",  # noqa: E501
    ] = None,
    resolution_status: Annotated[
        str | None, "Filter DebitReversals based on the resolution ('lost' or 'won')."
    ] = None,
    pagination_starting_after_cursor: Annotated[
        str | None,
        "An object ID that serves as a pagination cursor for fetching the next page of results.",
    ] = None,
    filter_by_status: Annotated[
        str | None,
        "Specify the status of DebitReversals to return. Options are: 'canceled', 'completed', or 'processing'.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTreasuryDebitReversals'."]:
    """Retrieves a list of debit reversals from Stripe.

    Use this tool to obtain a list of debit reversals from the Stripe Treasury API, which provides details on reversed debit transactions."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/debit_reversals",
            params=remove_none_values({
                "ending_before": pagination_ending_before_cursor,
                "expand": fields_to_expand,
                "financial_account": financial_account_id,
                "limit": max_number_of_debit_reversals,
                "received_debit": filter_by_received_debit_id,
                "resolution": resolution_status,
                "starting_after": pagination_starting_after_cursor,
                "status": filter_by_status,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_debit_reversal(
    context: ToolContext,
    debit_reversal_id: Annotated[
        str, "The unique identifier of the DebitReversal object to be retrieved."
    ],
    expand_fields: Annotated[
        list[str] | None,
        "List of fields to expand in the DebitReversal response. Provide an array of field names as strings.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetTreasuryDebitReversalsDebitReversal'."
]:
    """Retrieve details of a specific debit reversal.

    Use this tool to get information about a specific DebitReversal object by ID."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/debit_reversals/{debit_reversal}".format(  # noqa: UP032
                debit_reversal=debit_reversal_id
            ),
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_financial_account_details(
    context: ToolContext,
    financial_account_id: Annotated[
        str,
        "The unique identifier of the financial account to be retrieved. This ID is required to fetch the account details.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "A list of strings specifying which fields in the financial account details should be expanded in the response.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetTreasuryFinancialAccountsFinancialAccount'."
]:
    """Retrieve details of a specific financial account.

    Use this tool to obtain comprehensive information about a specific financial account using its identifier."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/financial_accounts/{financial_account}".format(  # noqa: UP032
                financial_account=financial_account_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_financial_account_features(
    context: ToolContext,
    financial_account_id: Annotated[
        str,
        "The ID of the financial account for which to retrieve feature information. This is required.",  # noqa: E501
    ],
    expand_response_fields: Annotated[
        list[str] | None,
        "A list of fields in the response that should be expanded for more detailed information.",
    ] = None,
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'GetTreasuryFinancialAccountsFinancialAccountFeatures'.",
]:
    """Retrieve features of a financial account.

    This tool retrieves information about the features associated with a specified financial account in Stripe's treasury service. Use it to get detailed features of a financial account when needed."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/financial_accounts/{financial_account}/features".format(  # noqa: UP032
                financial_account=financial_account_id
            ),
            params=remove_none_values({"expand": expand_response_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_inbound_transfers(
    context: ToolContext,
    financial_account_id: Annotated[
        str, "The ID of the FinancialAccount to retrieve associated inbound transfers."
    ],
    pagination_ending_before_id: Annotated[
        str | None,
        "The object ID defining your place in the list to fetch the previous page. Use this for pagination.",  # noqa: E501
    ] = None,
    expand_response_fields: Annotated[
        list[str] | None, "List of fields in the response to be expanded for detailed information."
    ] = None,
    transfer_limit: Annotated[
        int | None,
        "Set the maximum number of inbound transfer objects to return, ranging from 1 to 100. Default is 10.",  # noqa: E501
    ] = None,
    pagination_starting_after_object_id: Annotated[
        str | None,
        "Cursor for pagination to fetch the next page by using the object ID from the end of the previous result set.",  # noqa: E501
    ] = None,
    filter_by_transfer_status: Annotated[
        str | None,
        "Filter inbound transfers by their status: 'processing', 'succeeded', 'failed', or 'canceled'.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTreasuryInboundTransfers'."]:
    """Retrieve inbound transfers for a financial account.

    This tool fetches a list of inbound transfers sent from a specified financial account using Stripe's treasury services."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/inbound_transfers",
            params=remove_none_values({
                "ending_before": pagination_ending_before_id,
                "expand": expand_response_fields,
                "financial_account": financial_account_id,
                "limit": transfer_limit,
                "starting_after": pagination_starting_after_object_id,
                "status": filter_by_transfer_status,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_inbound_transfer_details(
    context: ToolContext,
    inbound_transfer_id: Annotated[
        str, "The unique identifier of the inbound transfer to retrieve details for."
    ],
    expand_fields: Annotated[
        list[str] | None,
        "Specify which fields in the response should be expanded for detailed information. Provide them as a list of strings.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTreasuryInboundTransfersId'."]:
    """Retrieve details of a specific inbound transfer.

    Use this tool to get information about a specific inbound transfer by providing its ID. It retrieves all associated details of the inbound transfer from the Stripe service."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/inbound_transfers/{id}".format(  # noqa: UP032
                id=inbound_transfer_id
            ),
            params=remove_none_values({"expand": expand_fields}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_outbound_payment_details(
    context: ToolContext,
    outbound_payment_id: Annotated[
        str, "The unique identifier of the OutboundPayment to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of fields to expand in the response for detailed information."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTreasuryOutboundPaymentsId'."]:
    """Retrieve details of an existing OutboundPayment by ID.

    Use this tool to obtain details of a specific OutboundPayment using its unique ID from Stripe's treasury service."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/outbound_payments/{id}".format(  # noqa: UP032
                id=outbound_payment_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_outbound_transfers(
    context: ToolContext,
    financial_account_id: Annotated[
        str, "The ID of the financial account to retrieve outbound transfers from."
    ],
    pagination_cursor_ending_before: Annotated[
        str | None,
        "Cursor for pagination to fetch the previous page of the outbound transfers list using an object ID.",  # noqa: E501
    ] = None,
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the response to be expanded. Provide field names as strings.",
    ] = None,
    limit_transfers: Annotated[
        int | None,
        "The number of outbound transfers to return. Valid range is 1 to 100, default is 10.",
    ] = None,
    pagination_starting_after: Annotated[
        str | None,
        "A cursor for pagination to fetch the next page of the list, using an object ID from a previous request.",  # noqa: E501
    ] = None,
    outbound_transfer_status_filter: Annotated[
        str | None,
        "Filter outbound transfers by status, such as 'processing', 'canceled', 'failed', 'posted', or 'returned'.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTreasuryOutboundTransfers'."]:
    """Retrieve outbound transfers from a financial account.

    This tool returns a list of outbound transfers sent from a specified financial account using Stripe's Treasury API."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/outbound_transfers",
            params=remove_none_values({
                "ending_before": pagination_cursor_ending_before,
                "expand": fields_to_expand,
                "financial_account": financial_account_id,
                "limit": limit_transfers,
                "starting_after": pagination_starting_after,
                "status": outbound_transfer_status_filter,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_outbound_transfer_details(
    context: ToolContext,
    outbound_transfer_id: Annotated[
        str, "The unique identifier for the outbound transfer to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "A list of fields in the response to be expanded for more details."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetTreasuryOutboundTransfersOutboundTransfer'."
]:
    """Retrieve details of a specific outbound transfer.

    Use this tool to get the details of an existing OutboundTransfer by providing the unique OutboundTransfer ID. It helps in tracking and managing outbound transfers."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/outbound_transfers/{outbound_transfer}".format(  # noqa: UP032
                outbound_transfer=outbound_transfer_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_received_credit_details(
    context: ToolContext,
    received_credit_id: Annotated[
        str,
        "The unique identifier of the ReceivedCredit to retrieve details for. This ID is required to fetch the specific credit's information.",  # noqa: E501
    ],
    fields_to_expand: Annotated[
        list[str] | None, "A list of fields in the response to expand for additional details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTreasuryReceivedCreditsId'."]:
    """Retrieve details of a specific ReceivedCredit by ID.

    This tool is used to obtain details about a specific ReceivedCredit in the Stripe Treasury. It requires the unique ReceivedCredit ID to fetch the information."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/received_credits/{id}".format(  # noqa: UP032
                id=received_credit_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_received_debits(
    context: ToolContext,
    financial_account_id: Annotated[
        str, "The ID of the FinancialAccount from which funds were pulled."
    ],
    pagination_cursor_previous_page: Annotated[
        str | None,
        "A cursor for pagination to fetch the previous page of the list. Use an object ID received in a previous response.",  # noqa: E501
    ] = None,
    expand_fields: Annotated[
        list[str] | None, "List of fields in the response to expand for more detailed information."
    ] = None,
    max_number_of_debits: Annotated[
        int | None,
        "Specify the maximum number of received debits to return. Accepts an integer between 1 and 100, default is 10.",  # noqa: E501
    ] = None,
    pagination_starting_after: Annotated[
        str | None, "An object ID for pagination to fetch the next page, starting after this ID."
    ] = None,
    debit_status_filter: Annotated[
        str | None, "Filter results by status: 'succeeded' or 'failed'."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTreasuryReceivedDebits'."]:
    """Retrieve a list of received debits from Stripe Treasury.

    Call this tool to obtain a list of received debits, which can be useful for financial reporting or auditing purposes."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/received_debits",
            params=remove_none_values({
                "ending_before": pagination_cursor_previous_page,
                "expand": expand_fields,
                "financial_account": financial_account_id,
                "limit": max_number_of_debits,
                "starting_after": pagination_starting_after,
                "status": debit_status_filter,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_received_debit_details(
    context: ToolContext,
    received_debit_id: Annotated[
        str, "The unique ID of the ReceivedDebit to retrieve details for. This ID is required."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "List of response fields to expand for detailed information."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTreasuryReceivedDebitsId'."]:
    """Retrieve details of a specific ReceivedDebit by ID.

    Use this tool to get information about an existing ReceivedDebit by providing its unique ID."""
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/received_debits/{id}".format(  # noqa: UP032
                id=received_debit_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_transaction_entry(
    context: ToolContext,
    transaction_entry_id: Annotated[
        str, "The unique identifier of the treasury transaction entry to retrieve."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "An array of field names to include in the response for additional detail.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTreasuryTransactionEntriesId'."]:
    """Fetches details of a specific treasury transaction entry.

    Use this tool to retrieve detailed information about a specific transaction entry from Stripe's treasury system by providing the transaction entry ID."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/transaction_entries/{id}".format(  # noqa: UP032
                id=transaction_entry_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_treasury_transaction_details(
    context: ToolContext,
    transaction_id: Annotated[
        str, "The ID of the treasury transaction you want to retrieve details for."
    ],
    fields_to_expand: Annotated[
        list[str] | None,
        "List of fields in the treasury transaction response to be expanded, specified as an array of strings.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetTreasuryTransactionsId'."]:
    """Retrieve details of a specific treasury transaction.

    This tool retrieves the details of an existing treasury transaction by its ID. Use it when you need to access specific information about a treasury transaction in Stripe."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/treasury/transactions/{id}".format(id=transaction_id),  # noqa: UP032
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def get_stripe_webhook_endpoints(
    context: ToolContext,
    pagination_ending_before: Annotated[
        str | None,
        "A cursor (object ID) for pagination to fetch the previous page of webhook endpoints.",
    ] = None,
    expand_fields: Annotated[
        list[str] | None,
        "A list of field names to expand in the response, allowing for detailed data retrieval.",
    ] = None,
    object_limit: Annotated[
        int | None,
        "The number of webhook endpoints to return, ranging from 1 to 100. Defaults to 10 if not specified.",  # noqa: E501
    ] = None,
    pagination_starting_after_id: Annotated[
        str | None,
        "An object ID used for pagination to fetch the next page in a list. Use the last object's ID from the current list.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'GetWebhookEndpoints'."]:
    """Retrieve a list of your Stripe webhook endpoints.

    This tool is used to retrieve a list of webhook endpoints configured in your Stripe account. It is helpful for managing and verifying your current webhook setup."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/webhook_endpoints",
            params=remove_none_values({
                "ending_before": pagination_ending_before,
                "expand": expand_fields,
                "limit": object_limit,
                "starting_after": pagination_starting_after_id,
            }),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def delete_stripe_webhook_endpoint(
    context: ToolContext,
    webhook_endpoint_id: Annotated[
        str,
        "The unique identifier for the Stripe webhook endpoint you wish to delete. This ID is required to specify which endpoint should be removed from your Stripe configurations.",  # noqa: E501
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'DeleteWebhookEndpointsWebhookEndpoint'."
]:
    """Delete a Stripe webhook endpoint by ID.

    Use this tool to delete a specific webhook endpoint in Stripe by providing its ID, helping manage webhook configurations."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/webhook_endpoints/{webhook_endpoint}".format(  # noqa: UP032
                webhook_endpoint=webhook_endpoint_id
            ),
            method="DELETE",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}


@tool(requires_secrets=["STRIPE_API_KEY"])
async def retrieve_webhook_endpoint(
    context: ToolContext,
    webhook_endpoint_id: Annotated[
        str, "The unique identifier for the Stripe webhook endpoint you want to retrieve."
    ],
    fields_to_expand: Annotated[
        list[str] | None, "A list of fields to expand in the response, specified as strings."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'GetWebhookEndpointsWebhookEndpoint'."
]:
    """Retrieve details of a specified webhook endpoint by ID.

    This tool retrieves information about a Stripe webhook endpoint using its ID. Use it when you need to get details such as status, URL, and events for a specific webhook endpoint."""  # noqa: E501
    async with httpx.AsyncClient() as client:
        response = await client.request(
            url="https://api.stripe.com/v1/webhook_endpoints/{webhook_endpoint}".format(  # noqa: UP032
                webhook_endpoint=webhook_endpoint_id
            ),
            params=remove_none_values({"expand": fields_to_expand}),
            method="GET",
            headers=remove_none_values({
                "Authorization": "Bearer {authorization}".format(
                    authorization=context.get_secret("STRIPE_API_KEY")
                )
            }),
        )
        response.raise_for_status()
        try:
            return {"response_json": response.json()}
        except Exception:
            return {"response_text": response.text}
