"""API Wrapper Tools for Trello

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.
"""

import asyncio
from typing import Annotated, Any

import httpx
from arcade_tdk import ToolContext, tool

# Retry configuration
INITIAL_RETRY_DELAY = 0.5  # seconds

HTTP_CLIENT = httpx.AsyncClient(
    timeout=httpx.Timeout(60.0, connect=10.0),
    limits=httpx.Limits(max_keepalive_connections=20, max_connections=100),
    transport=httpx.AsyncHTTPTransport(retries=3),
    http2=True,
    follow_redirects=True,
)


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}


async def make_request(
    url: str,
    method: str,
    params: dict[str, Any] | None = None,
    headers: dict[str, Any] | None = None,
    data: dict[str, Any] | None = None,
    max_retries: int = 3,
) -> httpx.Response:
    """Make an HTTP request with retry logic for 5xx server errors."""
    for attempt in range(max_retries):
        try:
            response = await HTTP_CLIENT.request(
                url=url,
                method=method,
                params=params,
                headers=headers,
                data=data,
            )
            response.raise_for_status()
        except httpx.HTTPStatusError as e:
            # Only retry on 5xx server errors
            if e.response.status_code >= 500 and attempt < max_retries - 1:
                # Exponential backoff: 0.5s, 1s, 2s
                await asyncio.sleep(INITIAL_RETRY_DELAY * (2**attempt))
                continue
            # Re-raise for 4xx errors or if max retries reached
            raise
        except httpx.RequestError:
            # Don't retry request errors (network issues are handled by transport)
            raise
        else:
            return response

    # This should never be reached, but satisfies type checker
    raise httpx.RequestError("Max retries exceeded")  # noqa: TRY003


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_action(
    context: ToolContext,
    action_id: Annotated[str, "The unique ID of the Trello action to retrieve details for."],
    action_fields: Annotated[
        str | None,
        "Specify 'all' or provide a comma-separated list of specific action fields to retrieve.",
    ] = None,
    member_fields_list: Annotated[
        str | None, "Specify 'all' or list member fields (comma-separated) to retrieve."
    ] = None,
    member_creator_fields: Annotated[
        str | None, "Specify `all` or list member fields to include for the action's creator."
    ] = None,
    include_display: Annotated[
        bool | None, "Include display details for the action. Accepts a boolean value."
    ] = None,
    include_entities: Annotated[
        bool | None, "Set to true to include entities related to the action in the response."
    ] = None,
    include_member: Annotated[
        bool | None,
        "A boolean to specify whether to include the member object related to the action.",
    ] = None,
    include_action_creator: Annotated[
        bool | None, "Include the member object for the creator of the action when true."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-actions-id'."]:
    """Retrieve details of a specific Trello action by ID.

    Use this tool to get detailed information about a specific action in Trello using the action's unique ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{id}".format(id=action_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "display": include_display,
            "entities": include_entities,
            "fields": action_fields,
            "member": include_member,
            "member_fields": member_fields_list,
            "memberCreator": include_action_creator,
            "memberCreator_fields": member_creator_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_trello_comment(
    context: ToolContext,
    new_comment_text: Annotated[
        str,
        "The updated text content for the Trello comment. This replaces the current comment text.",
    ],
    action_id: Annotated[
        str,
        "The unique identifier for the action to be updated. Required to specify which comment you want to edit.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-actions-id'."]:
    """Update a specific comment on Trello.

    Use this tool to edit the content of a comment action on Trello by specifying the action ID."""
    response = await make_request(
        url="https://api.trello.com/1/actions/{id}".format(id=action_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "text": new_comment_text,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_trello_comment_action(
    context: ToolContext,
    action_id: Annotated[str, "The ID of the Trello comment action to be deleted."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'delete-actions-id'."]:
    """Delete a specific comment action on Trello.

    Use this tool to delete a specific comment action on Trello by providing the action ID. Only comment actions are eligible for deletion."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{id}".format(id=action_id),  # noqa: UP032
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_action_property(
    context: ToolContext,
    action_id: Annotated[
        str, "The unique identifier for the Trello action whose property you want to retrieve."
    ],
    action_field: Annotated[
        str,
        "Select a specific property of a Trello action to retrieve. Options include: id, idMemberCreator, data, type, date, limits, display, memberCreator.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-actions-id-field'."]:
    """Retrieve a specific property of a Trello action.

    Use this tool to get a particular property value of a specified action in Trello. It should be called when you need details about a specific aspect of an action."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{id}/{field}".format(  # noqa: UP032
            id=action_id, field=action_field
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_board_for_action(
    context: ToolContext,
    action_id: Annotated[str, "The ID of the action to fetch the associated board."],
    board_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of board fields like 'id', 'name', 'desc', etc.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-actions-id-board'."]:
    """Fetch the board associated with a given action ID.

    Use this tool to retrieve information about the board linked to a specific action in Trello. It should be called when there's a need to understand the context or details of the board related to a particular action."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{id}/board".format(id=action_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": board_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_card_from_action(
    context: ToolContext,
    action_id: Annotated[
        str, "The unique ID of the action to retrieve the corresponding Trello card."
    ],
    card_fields: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of card fields to retrieve from the Trello card.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-actions-id-card'."]:
    """Get information about a Trello card from an action ID.

    This tool retrieves information about the Trello card associated with a given action ID. It should be called when you need to find details of the card linked to a specific action in Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{id}/card".format(id=action_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": card_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_action_list(
    context: ToolContext,
    action_id: Annotated[
        str, "The ID of the Trello action to retrieve the associated list details."
    ],
    list_fields: Annotated[
        str | None, "Specify `all` or a comma-separated list of list fields to retrieve."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-actions-id-list'."]:
    """Retrieve the list associated with a specific Trello action.

    This tool is used to get the list details for a given action in Trello. It should be called when you need to find out which list is linked to a particular Trello action."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{id}/list".format(id=action_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": list_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_action_member(
    context: ToolContext,
    action_id: Annotated[
        str, "The unique ID of the action to retrieve the associated member details."
    ],
    member_fields: Annotated[
        str | None,
        "Specify `all` or list specific member fields, separated by commas, to retrieve.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-actions-id-member'."]:
    """Retrieve the member associated with a specific action.

    This tool is used to get details about the member related to a particular action in Trello, excluding the creator. It should be called when you need information about the member involved in an action."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{id}/member".format(id=action_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": member_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_action_creator(
    context: ToolContext,
    action_id: Annotated[
        str, "The unique identifier for the Trello action to retrieve the creator."
    ],
    member_fields: Annotated[
        str | None,
        "A comma-separated list of member fields or 'all' to specify which details to retrieve about the member.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-actions-id-membercreator'."]:
    """Retrieve the creator of a Trello action.

    Use this tool to obtain information about the member who initiated a specific action in Trello. Ideal for tracking activity or understanding user interactions."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{id}/memberCreator".format(id=action_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": member_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_organization_of_action(
    context: ToolContext,
    action_id: Annotated[
        str, "The unique identifier for the action whose organization details are being retrieved."
    ],
    organization_fields: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of organization fields like `id,name` to retrieve specific details.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-actions-id-organization'."]:
    """Retrieve organization details for a given action ID.

    Use this tool to obtain information about the organization associated with a specific action on Trello. It should be called when you need to know which organization is linked to an action based on its ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{id}/organization".format(id=action_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": organization_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def modify_trello_action(
    context: ToolContext,
    new_comment_text: Annotated[
        str,
        "The new text to update the Trello comment with. Ensure it conveys the intended message clearly.",  # noqa: E501
    ],
    action_id: Annotated[
        str,
        "The ID of the Trello action to be updated. This ID identifies the specific comment action you want to modify.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-actions-id-text'."]:
    """Update a comment on Trello using the action ID.

    Use this tool to update the text of a comment on Trello by providing the action ID. This is helpful for modifying existing comments to correct or amend information."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{id}/text".format(id=action_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "value": new_comment_text,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_action_reactions(
    context: ToolContext,
    action_id: Annotated[str, "The ID of the Trello action to retrieve reactions for."],
    include_member_as_nested_resource: Annotated[
        bool | None, "Set to true to include member details as a nested resource in the response."
    ] = None,
    include_emoji: Annotated[
        bool | None, "Set to true to load the emoji as a nested resource in the response."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-actions-idaction-reactions'."]:
    """Retrieve reactions for a specific Trello action.

    Use this tool to get a list of all reactions associated with a specific action on Trello. It helps in understanding user interactions or feedback on particular actions."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{idAction}/reactions".format(idAction=action_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "member": include_member_as_nested_resource,
            "emoji": include_emoji,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_reaction_info(
    context: ToolContext,
    action_id: Annotated[
        str, "The unique identifier for the Trello action related to the reaction."
    ],
    reaction_id: Annotated[str, "The ID of the reaction to fetch details for."],
    include_member_as_nested_resource: Annotated[
        bool | None,
        "Set to true to load the member as a nested resource. Refer to Members Nested Resource documentation for more details.",  # noqa: E501
    ] = None,
    load_emoji_as_nested_resource: Annotated[
        bool | None,
        "Specify whether to load the emoji as a nested resource when retrieving reaction information. Set to true to include emoji details.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-actions-idaction-reactions-id'."
]:
    """Retrieve details of a specific Trello reaction.

    Use this tool to get detailed information about a specific reaction on a Trello action. It is helpful for understanding how users are interacting with a card action."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{idAction}/reactions/{id}".format(  # noqa: UP032
            idAction=action_id, id=reaction_id
        ),
        method="GET",
        params=remove_none_values({
            "member": include_member_as_nested_resource,
            "emoji": load_emoji_as_nested_resource,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_trello_reaction(
    context: ToolContext,
    action_id: Annotated[str, "The unique identifier for the Trello action."],
    reaction_id: Annotated[
        str, "The unique identifier for the reaction to be deleted from the Trello action."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-actions-idaction-reactions-id'."
]:
    """Delete a reaction from a Trello action.

    Use this tool to remove a specific reaction from a Trello action, given the action ID and reaction ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{idAction}/reactions/{id}".format(  # noqa: UP032
            idAction=action_id, id=reaction_id
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_reaction_summary_for_action(
    context: ToolContext,
    action_id: Annotated[
        str,
        "The ID of the specific Trello action for which you want to retrieve a reaction summary.",
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-actions-idaction-reactionsummary'."
]:
    """Retrieve a summary of reactions for a Trello action.

    Use this tool to get a summarized list of all reactions associated with a specific Trello action. It's useful for understanding how users have responded to an action on a Trello board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/actions/{idAction}/reactionsSummary".format(  # noqa: UP032
            idAction=action_id
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_application_compliance_data(
    context: ToolContext,
    application_key: Annotated[
        str, "The unique key associated with the application to retrieve its compliance data."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'applications-key-compliance'."]:
    """Retrieve an application's compliance data from Trello.

    Use this tool to get compliance information for a specific application by its key in Trello."""
    response = await make_request(
        url="https://api.trello.com/1/applications/{key}/compliance".format(key=application_key),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def trello_batch_get_requests(
    context: ToolContext,
    api_routes_list: Annotated[
        str,
        "A list of up to 10 API routes, starting with a forward slash. Do not include the API version number.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-batch'."]:
    """Execute multiple GET requests to Trello in one call.

    Use this tool to make up to 10 GET requests to the Trello API in a single batch. Ideal for retrieving multiple pieces of information efficiently."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/batch",
        method="GET",
        params=remove_none_values({
            "urls": api_routes_list,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_board_memberships(
    context: ToolContext,
    board_id: Annotated[
        str, "The unique identifier of the Trello board to get membership information for."
    ],
    membership_filter: Annotated[
        str | None, "Specify which group of members to retrieve: `admins`, `all`, `none`, `normal`."
    ] = None,
    member_fields_to_display: Annotated[
        str | None,
        "Specify fields to display for the member if `member=true`. Valid values include 'id'.",
    ] = None,
    include_activity: Annotated[
        bool | None, "Set to true to include activity details for premium organizations only."
    ] = None,
    display_organization_member_type: Annotated[
        bool | None, "Set to true to show the user's organization membership type, such as 'admin'."
    ] = None,
    include_nested_member_object: Annotated[
        bool | None,
        "Specify whether to include a nested member object in the response. True includes the object.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-boards-id-memberships'."]:
    """Get details on user memberships for a Trello board.

    Use this tool to retrieve information about the memberships users have on a specific Trello board. It should be called when you need to know details about user affiliations or roles within a board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/memberships".format(id=board_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "filter": membership_filter,
            "activity": include_activity,
            "orgMemberType": display_organization_member_type,
            "member": include_nested_member_object,
            "member_fields": member_fields_to_display,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_board_details(
    context: ToolContext,
    board_id: Annotated[str, "The unique identifier of the Trello board to retrieve details for."],
    include_actions: Annotated[
        str | None,
        "Indicate whether to include actions related to the board. Set to true to include.",
    ] = None,
    board_stars_filter: Annotated[
        str | None,
        "Specify how board stars should be filtered. Use 'mine' to get your starred boards, or 'none' for all other boards.",  # noqa: E501
    ] = None,
    include_card_details: Annotated[
        str | None,
        "Specify if card details should be included as a nested resource in the response. Read more about cards as nested resources.",  # noqa: E501
    ] = None,
    include_checklists: Annotated[
        str | None,
        "Specify whether to include checklists as a nested resource in the response. Accepts a boolean value (true or false).",  # noqa: E501
    ] = None,
    board_fields_to_include: Annotated[
        str | None,
        "Specify which fields of the board to include in the response. Use 'all' or a comma-separated list (e.g., 'name,url').",  # noqa: E501
    ] = None,
    include_labels_resource: Annotated[
        str | None,
        "Specify whether to include the label details as a nested resource in the response. Typically expected values might be strings such as 'true' or 'false'.",  # noqa: E501
    ] = None,
    include_lists: Annotated[
        str | None, "Include details of lists on the Trello board. This is a nested resource."
    ] = None,
    include_members: Annotated[
        str | None,
        "Include member details as a nested resource in the response. Use 'true' to include or leave empty to exclude.",  # noqa: E501
    ] = None,
    include_memberships: Annotated[
        str | None,
        "Include detailed membership information in the response. Set to 'true' to enable.",
    ] = None,
    include_card_plugin_data: Annotated[
        bool | None,
        "Set to true to include card plugin data in the response. Use with the `cards` parameter.",
    ] = None,
    include_custom_fields: Annotated[
        bool | None, "Set to true to include custom fields in the board response."
    ] = None,
    include_plugin_data: Annotated[
        bool | None,
        "Determines whether plugin data for the board should be included in the response. Accepts true or false.",  # noqa: E501
    ] = None,
    include_organization: Annotated[
        bool | None,
        "Include the organization as a nested resource in the response. Set to true to include.",
    ] = None,
    include_organization_plugin_data: Annotated[
        bool | None,
        "Set to true to include organization pluginData in the response. Must be used with the `organization` parameter.",  # noqa: E501
    ] = None,
    include_my_preferences: Annotated[
        bool | None, "Set to true to include your preferences with the board details."
    ] = None,
    include_tags: Annotated[
        bool | None,
        "Include tags (also known as collections) that the board belongs to. Set true to retrieve them, false otherwise.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-boards-id'."]:
    """Retrieve details for a specific Trello board.

    Use this tool to obtain information about a particular Trello board by providing its ID. It helps in accessing and displaying the specific board's details effortlessly."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}".format(id=board_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "actions": include_actions,
            "boardStars": board_stars_filter,
            "cards": include_card_details,
            "card_pluginData": include_card_plugin_data,
            "checklists": include_checklists,
            "customFields": include_custom_fields,
            "fields": board_fields_to_include,
            "labels": include_labels_resource,
            "lists": include_lists,
            "members": include_members,
            "memberships": include_memberships,
            "pluginData": include_plugin_data,
            "organization": include_organization,
            "organization_pluginData": include_organization_plugin_data,
            "myPrefs": include_my_preferences,
            "tags": include_tags,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_trello_board(
    context: ToolContext,
    board_id: Annotated[str, "The unique identifier of the Trello board to update."],
    board_new_name: Annotated[
        str | None, "The new name for the board. Must be 1 to 16384 characters long."
    ] = None,
    new_board_description: Annotated[
        str | None, "A new description for the board, from 0 to 16384 characters long."
    ] = None,
    user_subscribed_status: Annotated[
        str | None,
        "Indicate if the acting user is subscribed to the board. Expected values are 'true' or 'false'.",  # noqa: E501
    ] = None,
    workspace_id_for_board: Annotated[
        str | None, "The ID of the Workspace to which the board should be moved."
    ] = None,
    board_permission_level: Annotated[
        str | None, "Set the board's permission level to 'org', 'private', or 'public'."
    ] = None,
    board_invitation_permission: Annotated[
        str | None,
        "Specify who can invite people to this board. Choose between 'admins' or 'members'.",
    ] = None,
    voting_permission: Annotated[
        str | None,
        "Specify who can vote on this board. Options: disabled, members, observers, org, public.",
    ] = None,
    comment_permission: Annotated[
        str | None,
        "Specifies who can comment on cards: disabled, members, observers, org, or public.",
    ] = None,
    board_background_id: Annotated[
        str | None,
        "Specify the ID of a custom background or choose from predefined colors: blue, orange, green, red, purple, pink, lime, sky, grey.",  # noqa: E501
    ] = None,
    card_aging_preference: Annotated[
        str | None, "Specifies the card aging style on the board. Options: 'pirate', 'regular'."
    ] = None,
    green_label_name: Annotated[
        str | None, "Set the name for the green label. Must be 1 to 16384 characters long."
    ] = None,
    yellow_label_name: Annotated[
        str | None,
        "Specify the name for the yellow label on the board. Must be between 1 and 16384 characters.",  # noqa: E501
    ] = None,
    orange_label_name: Annotated[
        str | None, "The name for the orange label. Must be 1 to 16384 characters long."
    ] = None,
    red_label_name: Annotated[
        str | None, "Name for the red label on the board. It should be 1 to 16384 characters long."
    ] = None,
    purple_label_name: Annotated[
        str | None, "Name for the purple label, 1 to 16384 characters long."
    ] = None,
    blue_label_name: Annotated[
        str | None, "Specify the name for the blue label, must be 1 to 16384 characters long."
    ] = None,
    is_board_closed: Annotated[
        bool | None,
        "Indicates if the board is closed. Use `true` to close (archive) the board, `false` to keep it open.",  # noqa: E501
    ] = None,
    allow_workspace_self_join: Annotated[
        bool | None,
        "Set to true to allow Workspace members to join the board themselves; false to disallow.",
    ] = None,
    display_card_covers: Annotated[
        bool | None, "Set to true to display card covers on the board, false to hide them."
    ] = None,
    hide_votes: Annotated[
        bool | None, "Set to true to hide voters on cards; false to show them."
    ] = None,
    enable_calendar_feed: Annotated[
        bool | None, "Set to true to enable the calendar feed; false to disable it."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-boards-id'."]:
    """Update an existing Trello board by ID.

    Use this tool to update the properties of an existing Trello board using its ID."""
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}".format(id=board_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "name": board_new_name,
            "desc": new_board_description,
            "closed": is_board_closed,
            "subscribed": user_subscribed_status,
            "idOrganization": workspace_id_for_board,
            "prefs/permissionLevel": board_permission_level,
            "prefs/selfJoin": allow_workspace_self_join,
            "prefs/cardCovers": display_card_covers,
            "prefs/hideVotes": hide_votes,
            "prefs/invitations": board_invitation_permission,
            "prefs/voting": voting_permission,
            "prefs/comments": comment_permission,
            "prefs/background": board_background_id,
            "prefs/cardAging": card_aging_preference,
            "prefs/calendarFeedEnabled": enable_calendar_feed,
            "labelNames/green": green_label_name,
            "labelNames/yellow": yellow_label_name,
            "labelNames/orange": orange_label_name,
            "labelNames/red": red_label_name,
            "labelNames/purple": purple_label_name,
            "labelNames/blue": blue_label_name,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_trello_board(
    context: ToolContext,
    board_id: Annotated[str, "The ID of the Trello board to be deleted."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'delete-boards-id'."]:
    """Delete a Trello board by ID.

    Use this tool to delete a specified Trello board by providing its ID. It confirms the deletion of the board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}".format(id=board_id),  # noqa: UP032
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_board_field(
    context: ToolContext,
    board_id: Annotated[
        str, "The unique identifier of the Trello board to retrieve the field from."
    ],
    board_field_name: Annotated[
        str,
        "Specify the field name to retrieve from the Trello board. Valid values: closed, dateLastActivity, dateLastView, desc, descData, idMemberCreator, idOrganization, invitations, invited, labelNames, memberships, name, pinned, powerUps, prefs, shortLink, shortUrl, starred, subscribed, url.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-boards-id-field'."]:
    """Retrieve a specific field value from a Trello board.

    Use this tool to get a specific field value from a Trello board by providing the board ID and the field name."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/{field}".format(  # noqa: UP032
            id=board_id, field=board_field_name
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_board_stars(
    context: ToolContext,
    board_id: Annotated[
        str, "The unique identifier for the Trello board to retrieve star information from."
    ],
    filter_by_board_stars: Annotated[
        str | None,
        "Specify the filter for board stars. Valid values are 'mine' to select boards starred by the current user, or 'none' for no filtering.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-boards-id-boardstars'."]:
    """Retrieve board star details from Trello.

    This tool is used to get information about the stars on a specific Trello board. It should be called when you want to check which users have starred a board or to manage board recognition."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{boardId}/boardStars".format(boardId=board_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "filter": filter_by_board_stars,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_board_checklists(
    context: ToolContext,
    board_id: Annotated[
        str, "The unique identifier of the Trello board for which to retrieve checklists."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'boards-id-checklists'."]:
    """Retrieve all checklists from a Trello board.

    Use this tool to get a list of all checklists on a specific Trello board by providing the board ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/checklists".format(id=board_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_open_cards_on_board(
    context: ToolContext,
    board_id: Annotated[
        str,
        "The ID of the Trello board from which to retrieve all open cards. This must be a valid board ID.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-boards-id-cards'."]:
    """Retrieve all open cards from a Trello board.

    Use this tool to get all open cards on a specific Trello board by providing the board ID. It is useful for managing and viewing tasks or items in an active state on a Trello board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/cards".format(id=board_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_filtered_trello_board_cards(
    context: ToolContext,
    board_id: Annotated[
        str, "The unique identifier for the Trello board from which to retrieve cards."
    ],
    card_filter_type: Annotated[
        str,
        "Filter for cards on the board. Options: all, closed, complete, incomplete, none, open, visible.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-boards-id-cards-filter'."]:
    """Retrieve filtered cards from a Trello board.

    Use this tool to get cards from a specified Trello board that match a certain filter. Ideal for retrieving specific sets of cards based on criteria like labels, members, or statuses."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/cards/{filter}".format(  # noqa: UP032
            id=board_id, filter=card_filter_type
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_board_custom_fields(
    context: ToolContext,
    board_id: Annotated[
        str, "The unique identifier of the Trello board to retrieve custom field definitions for."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-boards-id-customfields'."]:
    """Get Custom Field Definitions for a Trello board.

    Use this tool to retrieve the Custom Field Definitions associated with a specific Trello board by providing the board ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/customFields".format(id=board_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_label_on_board(
    context: ToolContext,
    label_name: Annotated[
        str, "The name of the label to be created, between 1 and 16384 characters."
    ],
    label_color: Annotated[
        str, "Sets the color of the new label. Accepts a label color or `null` for no color."
    ],
    board_id: Annotated[str, "The ID of the Trello board where the new label will be created."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-boards-id-labels'."]:
    """Create a new label on a Trello board.

    Use this tool to create a new label on a specific Trello board by providing the board ID and label details."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/labels".format(id=board_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "name": label_name,
            "color": label_color,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_lists_on_board(
    context: ToolContext,
    board_id: Annotated[str, "The unique identifier of the Trello board to fetch its lists."],
    card_filter: Annotated[
        str | None,
        "Specify the filter to apply to cards on the list. Options are: 'all', 'closed', 'none', 'open'.",  # noqa: E501
    ] = None,
    card_fields_to_retrieve: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of card fields to retrieve from the board lists.",
    ] = None,
    list_filter: Annotated[
        str | None, "Specify a filter to apply to lists: `all`, `closed`, `none`, or `open`."
    ] = None,
    list_fields: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of list fields to retrieve from the Trello board. Use 'all' to access every field available.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-boards-id-lists'."]:
    """Retrieve all lists from a specified Trello board.

    Use this tool to get information about all the lists on a specific Trello board by providing the board ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/lists".format(id=board_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "cards": card_filter,
            "card_fields": card_fields_to_retrieve,
            "filter": list_filter,
            "fields": list_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_trello_list(
    context: ToolContext,
    list_name: Annotated[
        str, "The name of the list to be created, ranging from 1 to 16384 characters."
    ],
    board_id: Annotated[
        str, "The unique identifier for the Trello board where the list will be created."
    ],
    list_position: Annotated[
        str | None,
        "Defines the position of the new list on the board. Accepts 'top', 'bottom', or a specific positive number for custom ordering.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-boards-id-lists'."]:
    """Create a new list on a Trello board.

    This tool is used to create a new list on a specified Trello board. It should be called when you need to organize tasks or categories by adding a new list to an existing board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/lists".format(id=board_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "name": list_name,
            "pos": list_position,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_filtered_lists_on_board(
    context: ToolContext,
    board_id: Annotated[
        str, "The unique identifier for the Trello board from which to retrieve lists."
    ],
    list_filter: Annotated[
        str,
        "Filter criteria for the lists on the board. Options are: 'all', 'closed', 'none', 'open'.",
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-boards-id-lists-filter'."]:
    """Retrieve filtered lists from a Trello board with specific criteria.

    Use this tool to obtain lists from a specified Trello board, applying specific filters to tailor the results. Ideal for managing board workflows by focusing on particular list attributes."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/lists/{filter}".format(  # noqa: UP032
            id=board_id, filter=list_filter
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_board_members(
    context: ToolContext,
    board_id: Annotated[
        str, "The unique identifier of the Trello board whose members you want to retrieve."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-boards-id-members'."]:
    """Retrieve the members of a Trello board.

    Use this tool to get a list of members associated with a specific Trello board by providing the board ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/members".format(id=board_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def add_member_to_trello_board(
    context: ToolContext,
    member_type: Annotated[
        str, "Specifies the role of the member on the board. Accepts: admin, normal, observer."
    ],
    board_id: Annotated[
        str, "The ID of the Trello board to which a member will be added. Provide a valid board ID."
    ],
    member_id: Annotated[str, "The ID of the member to add to the Trello board."],
    allow_billable_guest: Annotated[
        bool | None,
        "Optional boolean to allow organization admins to add multi-board guests onto the board.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-boards-id-members-idmember'."]:
    """Add a member to a Trello board.

    Use this tool to add a specific member to a Trello board by specifying the board ID and the member ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/members/{idMember}".format(  # noqa: UP032
            id=board_id, idMember=member_id
        ),
        method="PUT",
        params=remove_none_values({
            "type": member_type,
            "allowBillableGuest": allow_billable_guest,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def remove_member_from_trello_board(
    context: ToolContext,
    board_id: Annotated[str, "The ID of the Trello board from which to remove the member."],
    member_id_to_remove: Annotated[str, "The ID of the member to remove from the Trello board."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'boardsidmembersidmember'."]:
    """Remove a member from a Trello board.

    Use this tool to remove a member from a specified Trello board by providing the board and member IDs."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/members/{idMember}".format(  # noqa: UP032
            id=board_id, idMember=member_id_to_remove
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_board_membership(
    context: ToolContext,
    membership_type: Annotated[
        str, "Specifies the role of the member on the board: 'admin', 'normal', or 'observer'."
    ],
    board_id: Annotated[
        str,
        "The ID of the Trello board to update the membership for. This is required to specify which board is being modified.",  # noqa: E501
    ],
    membership_id_to_add: Annotated[str, "The ID of the membership to add to the board."],
    membership_field_type: Annotated[
        str | None,
        "Specify the type of membership field to update. Valid values include all, avatarHash, bio, bioData, confirmed, fullName, idPremOrgsAdmin, initials, memberType, products, status, url, username.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-boards-id-memberships-idmembership'."
]:
    """Update an existing membership on a Trello board.

    Use this tool to modify details of a membership on a Trello board. It requires specifying the board ID and the membership ID to update."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/memberships/{idMembership}".format(  # noqa: UP032
            id=board_id, idMembership=membership_id_to_add
        ),
        method="PUT",
        params=remove_none_values({
            "type": membership_type,
            "member_fields": membership_field_type,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_board_email_position(
    context: ToolContext,
    email_position_preference: Annotated[
        str, "Specify the email address position on the board. Valid values are 'bottom' or 'top'."
    ],
    board_id: Annotated[
        str, "The ID of the Trello board whose email position preference you want to update."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-boards-id-myprefs-emailposition'."
]:
    """Update the email position preference on a Trello board.

    This tool updates the email position preference setting for a specified Trello board. Use this tool when you need to change how emails are displayed or organized on a board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/myPrefs/emailPosition".format(id=board_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "value": email_position_preference,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def set_default_email_to_board_list(
    context: ToolContext,
    email_list_id: Annotated[
        str, "The ID of the email list to set as the default for email-to-board cards."
    ],
    board_id: Annotated[str, "The unique identifier of the Trello board to update."],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-boards-id-myprefs-idemaillist'."
]:
    """Change the default list for email-to-board cards.

    Use this tool to specify which list newly emailed cards are added to on a Trello board."""
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/myPrefs/idEmailList".format(id=board_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "value": email_list_id,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_board_sidebar_preference(
    context: ToolContext,
    board_id: Annotated[
        str, "The unique identifier of the Trello board to update the sidebar preference."
    ],
    show_sidebar: Annotated[
        bool,
        "Determines if the sidebar should be visible on the board. Set to true to show and false to hide.",  # noqa: E501
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-boards-id-myPrefs-showsidebar'."
]:
    """Update the sidebar visibility preference for a Trello board.

    Use this tool to modify the sidebar visibility settings on a specified Trello board. Call this tool when you need to enable or disable the sidebar display on a Trello board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/myPrefs/showSidebar".format(id=board_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "value": show_sidebar,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_sidebar_activity_preference(
    context: ToolContext,
    board_id: Annotated[
        str, "The unique identifier for the Trello board to update the sidebar activity preference."
    ],
    show_sidebar_activity: Annotated[
        bool, "Set to true to display the sidebar activity; false to hide it."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-boards-id-myPrefs-showsidebaractivity'."
]:
    """Update sidebar activity display preference for a Trello board.

    Use this tool to update the preference for displaying the sidebar activity on a specific Trello board. Useful when adjusting board settings to improve user interaction."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/myPrefs/showSidebarActivity".format(id=board_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "value": show_sidebar_activity,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_sidebar_board_actions_prefs(
    context: ToolContext,
    board_id: Annotated[
        str, "The unique identifier of the Trello board to update the sidebar actions preference."
    ],
    show_sidebar_board_actions: Annotated[
        bool, "Set to 'true' to show sidebar board actions, or 'false' to hide them."
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'put-boards-id-myPrefs-showsidebarboardactions'.",
]:
    """Update the showSidebarBoardActions preference on a board.

    Use this tool to update the preference for displaying sidebar board actions on a Trello board. It should be called when you want to modify the visibility of board action buttons in the sidebar."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/myPrefs/showSidebarBoardActions".format(  # noqa: UP032
            id=board_id
        ),
        method="PUT",
        params=remove_none_values({
            "value": show_sidebar_board_actions,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_trello_sidebar_members_view(
    context: ToolContext,
    board_id: Annotated[
        str,
        "The unique identifier of the Trello board to update the sidebar members view preference.",
    ],
    show_sidebar_members: Annotated[
        bool, "Set to true to show members of the board in the sidebar; false to hide them."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-boards-id-myPrefs-showsidebarmembers'."
]:
    """Update the sidebar members view preference on a Trello board.

    This tool updates the 'showSidebarMembers' preference for a specific Trello board, adjusting whether members are displayed in the sidebar. Use it to customize a board's appearance as needed."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/myPrefs/showSidebarMembers".format(id=board_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "value": show_sidebar_members,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_trello_board(
    context: ToolContext,
    board_name: Annotated[
        str, "The name of the new Trello board. Must be 1 to 16384 characters long."
    ],
    board_description: Annotated[
        str | None, "A new description for the board, ranging from 0 to 16384 characters."
    ] = None,
    workspace_id_or_name: Annotated[
        str | None, "The ID or name of the Workspace where the board will be created."
    ] = None,
    source_board_id: Annotated[
        str | None,
        "The ID of the board to copy into the new board. If provided, the new board will be a copy of the specified board.",  # noqa: E501
    ] = None,
    keep_original_cards: Annotated[
        str | None,
        "Specify if cards from the original board should be retained in the new board. Use 'cards' to keep them or 'none' to exclude them.",  # noqa: E501
    ] = None,
    enable_power_ups: Annotated[
        str | None,
        "Specifies which Power-Ups to enable on the new board. Options include: `all`, `calendar`, `cardAging`, `recap`, `voting`.",  # noqa: E501
    ] = None,
    board_permission_level: Annotated[
        str | None,
        "Specifies the permission level of the board. Choose from 'org', 'private', or 'public'.",
    ] = None,
    set_voting_permissions: Annotated[
        str | None,
        "Set who can vote on the board. Options: 'disabled', 'members', 'observers', 'org', 'public'.",  # noqa: E501
    ] = None,
    comment_permissions: Annotated[
        str | None,
        "Specifies who can comment on cards on this board. Options: `disabled`, `members`, `observers`, `org`, `public`.",  # noqa: E501
    ] = None,
    invitation_permission_level: Annotated[
        str | None,
        "Specifies who can invite users to join the board. Options: 'members' or 'admins'.",
    ] = None,
    board_background_color: Annotated[
        str | None,
        "Select a background color for the board. Options are: `blue`, `orange`, `green`, `red`, `purple`, `pink`, `lime`, `sky`, `grey`, or a custom background ID.",  # noqa: E501
    ] = None,
    card_aging_type: Annotated[
        str | None, "Type of card aging for the board. Choose 'pirate' or 'regular'."
    ] = None,
    use_default_labels: Annotated[
        bool | None, "Set to true to use the default set of labels."
    ] = None,
    add_default_lists: Annotated[
        bool | None,
        "Determines if the default lists (To Do, Doing, Done) should be added to the board. Ignored if `idBoardSource` is provided.",  # noqa: E501
    ] = None,
    allow_self_join: Annotated[
        bool | None,
        "Set to true to allow users to join the board themselves; false requires an invitation.",
    ] = None,
    enable_card_covers: Annotated[
        bool | None, "Set to true to enable card covers on the board."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-boards'."]:
    """Create a new board in Trello.

    Use this tool to create a new board on Trello. It should be called when there's a need to organize tasks or projects into a new board structure."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/",
        method="POST",
        params=remove_none_values({
            "name": board_name,
            "defaultLabels": use_default_labels,
            "defaultLists": add_default_lists,
            "desc": board_description,
            "idOrganization": workspace_id_or_name,
            "idBoardSource": source_board_id,
            "keepFromSource": keep_original_cards,
            "powerUps": enable_power_ups,
            "prefs_permissionLevel": board_permission_level,
            "prefs_voting": set_voting_permissions,
            "prefs_comments": comment_permissions,
            "prefs_invitations": invitation_permission_level,
            "prefs_selfJoin": allow_self_join,
            "prefs_cardCovers": enable_card_covers,
            "prefs_background": board_background_color,
            "prefs_cardAging": card_aging_type,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def generate_trello_board_calendar_key(
    context: ToolContext,
    board_id: Annotated[
        str, "The unique identifier of the Trello board for which to generate a calendar key."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'post-boards-id-calendarkey-generate'."
]:
    """Generates a calendar key for a Trello board.

    Use this tool to generate a calendar key for an existing Trello board. This key can be used to integrate the board's calendar with other applications."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/calendarKey/generate".format(id=board_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def generate_board_email_key(
    context: ToolContext,
    board_id: Annotated[
        str, "The unique identifier of the Trello board for which to generate an email key."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'post-boards-id-emailkey-generate'."
]:
    """Generate an email key for a Trello board.

    This tool generates an email key for a specified Trello board, allowing emails to be sent directly to the board. It should be called when you need to enable email integration for a board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/emailKey/generate".format(id=board_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_board_tag(
    context: ToolContext,
    organization_tag_id: Annotated[
        str, "Provide the ID of a tag from the organization this board belongs to."
    ],
    board_id: Annotated[
        str, "The unique identifier of the Trello board where the tag will be created."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-boards-id-idtags'."]:
    """Create a new tag for a Trello board.

    Use this tool to create a new tag for a specific board in Trello. Ideal for organizing and categorizing tasks within a board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/idTags".format(id=board_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "value": organization_tag_id,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def mark_trello_board_as_viewed(
    context: ToolContext,
    board_id: Annotated[str, "The unique identifier of the Trello board to be marked as viewed."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-boards-id-markedasviewed'."]:
    """Marks a Trello board as viewed for a user.

    Use this tool when you need to mark a Trello board as viewed. It helps manage board activity tracking by indicating when a user has viewed it."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/markedAsViewed".format(id=board_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_board_power_ups(
    context: ToolContext,
    board_id: Annotated[str, "The ID of the Trello Board for which to retrieve enabled Power-Ups."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-boards-id-boardplugins'."]:
    """Retrieve the enabled Power-Ups on a Trello board.

    Use this tool to get a list of Power-Ups (features and integrations) that are currently enabled on a specific Trello board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/boardPlugins".format(id=board_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_board_power_ups(
    context: ToolContext,
    board_id: Annotated[str, "The unique identifier for the Trello board to list its Power-Ups."],
    power_up_status_filter: Annotated[
        str | None, "Specify whether to list 'enabled' or 'available' Power-Ups on the board."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-board-id-plugins'."]:
    """Retrieve the Power-Ups enabled on a Trello board.

    Use this tool to get a list of all the Power-Ups currently active on a specific Trello board. It's useful for understanding which enhancements are applied to the board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/boards/{id}/plugins".format(id=board_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "filter": power_up_status_filter,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_trello_card(
    context: ToolContext,
    list_id_for_card: Annotated[str, "The ID of the list where the new card will be created."],
    card_name: Annotated[
        str | None, "The title or name of the card to be created in Trello."
    ] = None,
    card_description: Annotated[
        str | None,
        "A detailed text description for the Trello card. This helps in adding more context or information about the card's purpose or content.",  # noqa: E501
    ] = None,
    card_position: Annotated[
        str | None, "Position of the new card. Use 'top', 'bottom', or a specific float value."
    ] = None,
    card_due_date: Annotated[
        str | None,
        "The due date for the Trello card, formatted as a string. Use ISO 8601 format (YYYY-MM-DD) for consistency.",  # noqa: E501
    ] = None,
    start_date: Annotated[
        str | None, "The start date of the card in YYYY-MM-DD format, or `null` if not applicable."
    ] = None,
    member_ids_to_add: Annotated[
        list[dict[str, str]] | None, "A list of Trello member IDs to add to the card."
    ] = None,
    label_ids: Annotated[
        list[dict[str, str]] | None,
        "List of label IDs to add to the card. Provide IDs as strings in a list format.",
    ] = None,
    attachment_url: Annotated[
        str | None,
        "A URL starting with `http://` or `https://` to be attached to the card upon creation.",
    ] = None,
    attachment_file_path: Annotated[
        str | None,
        "The local file path to be attached to the Trello card. This file will be uploaded when the card is created.",  # noqa: E501
    ] = None,
    attachment_mime_type: Annotated[
        str | None,
        "The MIME type of the attachment for the Trello card. Maximum length is 256 characters.",
    ] = None,
    copy_card_source_id: Annotated[
        str | None, "The ID of a card to copy properties from into the new card."
    ] = None,
    copy_properties_from_source: Annotated[
        str | None,
        "Specify properties to copy if using `idCardSource`. Use `all` or a comma-separated list of: `attachments,checklists,customFields,comments,due,start,labels,members,stickers`.",  # noqa: E501
    ] = None,
    map_view_address: Annotated[
        str | None,
        "The address for use with the Map View in Trello. This can enhance location-based features.",  # noqa: E501
    ] = None,
    location_name: Annotated[
        str | None, "The name of the location for use with the Map View in Trello."
    ] = None,
    map_coordinates: Annotated[
        str | None, "Coordinates for the Map View in the format latitude,longitude."
    ] = None,
    card_display_role: Annotated[
        str | None,
        "Specifies how the card should be displayed. Options: `separator` for visual separation, `board` for linking to a Trello board, `mirror` for linking to a Trello card, and `link` for a general URL link.",  # noqa: E501
    ] = None,
    card_completion_status: Annotated[
        bool | None,
        "Indicate if the card's status is complete. True means the card is complete, and false means it is incomplete.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-cards'."]:
    """Create a new card in Trello.

    Use this tool to create a new card on a Trello board. This is useful when you need to organize tasks or information by adding cards to your Trello workflow."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards",
        method="POST",
        params=remove_none_values({
            "name": card_name,
            "desc": card_description,
            "pos": card_position,
            "due": card_due_date,
            "start": start_date,
            "dueComplete": card_completion_status,
            "idList": list_id_for_card,
            "idMembers": member_ids_to_add,
            "idLabels": label_ids,
            "urlSource": attachment_url,
            "fileSource": attachment_file_path,
            "mimeType": attachment_mime_type,
            "idCardSource": copy_card_source_id,
            "keepFromSource": copy_properties_from_source,
            "address": map_view_address,
            "locationName": location_name,
            "coordinates": map_coordinates,
            "cardRole": card_display_role,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_card_by_id(
    context: ToolContext,
    card_id: Annotated[str, "The unique identifier for the Trello card to retrieve details for."],
    card_fields_to_retrieve: Annotated[
        str | None,
        "`all` or a comma-separated list of fields to retrieve for the Trello card. Defaults: badges, checkItemStates, closed, dateLastActivity, desc, descData, due, start, idBoard, idChecklists, idLabels, idList, idMembers, idShort, idAttachmentCover, manualCoverAttachment, labels, name, pos, shortUrl, url",  # noqa: E501
    ] = None,
    include_action_details: Annotated[
        str | None,
        "Specifies whether to include action details related to the card. Refer to Trello's Actions Nested Resource for options.",  # noqa: E501
    ] = None,
    include_attachments: Annotated[
        str | None,
        "Specify 'true', 'false', or 'cover' to determine the type of attachments to return.",
    ] = None,
    attachment_fields: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of attachment fields to retrieve for the card.",
    ] = None,
    member_fields_selection: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of member fields like avatarHash, fullName, initials, username. Defaults to these fields if not specified.",  # noqa: E501
    ] = None,
    member_voted_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of member fields like 'avatarHash, fullName, initials, username'. Defaults to specific fields if not provided.",  # noqa: E501
    ] = None,
    include_checklists: Annotated[
        str | None, "Specify whether to include checklists in the card data. Use 'all' or 'none'."
    ] = None,
    checklist_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of fields (idBoard, idCard, name, pos) to return for checklists.",  # noqa: E501
    ] = None,
    board_fields_to_return: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of board fields like name, desc, idOrganization. Defaults are name, desc, descData, closed, idOrganization, pinned, url, prefs.",  # noqa: E501
    ] = None,
    sticker_fields: Annotated[
        str | None, "Specify `all` or a comma-separated list of sticker fields to retrieve."
    ] = None,
    include_card_members: Annotated[
        bool | None, "Set to true to include member objects on the card, false to exclude them."
    ] = None,
    include_members_who_voted: Annotated[
        bool | None,
        "Set to `true` to return member objects for members who voted on the card; set to `false` to exclude them.",  # noqa: E501
    ] = None,
    include_check_item_states: Annotated[
        bool | None, "Set to true to include check item states in the Trello card details response."
    ] = None,
    include_board_object: Annotated[
        bool | None, "Set to true to return the board object the card is on."
    ] = None,
    include_lists_nested_resource: Annotated[
        bool | None,
        "Specify whether to include information about the Lists Nested Resource for the card. Use a boolean value.",  # noqa: E501
    ] = None,
    include_plugin_data: Annotated[
        bool | None, "Set to true to include pluginData on the card with the response."
    ] = None,
    include_stickers: Annotated[
        bool | None, "Set to true to include sticker models in the response."
    ] = None,
    include_custom_field_items: Annotated[
        bool | None,
        "Set to true to include custom field items in the card details, or false to exclude them.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id'."]:
    """Retrieve Trello card details using card ID.

    Use this tool to get detailed information about a Trello card by providing its unique ID. Ideal for accessing specific card details such as description, labels, and more."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}".format(id=card_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": card_fields_to_retrieve,
            "actions": include_action_details,
            "attachments": include_attachments,
            "attachment_fields": attachment_fields,
            "members": include_card_members,
            "member_fields": member_fields_selection,
            "membersVoted": include_members_who_voted,
            "memberVoted_fields": member_voted_fields,
            "checkItemStates": include_check_item_states,
            "checklists": include_checklists,
            "checklist_fields": checklist_fields,
            "board": include_board_object,
            "board_fields": board_fields_to_return,
            "list": include_lists_nested_resource,
            "pluginData": include_plugin_data,
            "stickers": include_stickers,
            "sticker_fields": sticker_fields,
            "customFieldItems": include_custom_field_items,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_trello_card(
    context: ToolContext,
    card_id_to_delete: Annotated[str, "The unique ID of the Trello card to delete."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'delete-cards-id'."]:
    """Deletes a card from Trello by ID.

    Use this tool to delete a specific card from a Trello board by providing its ID. Useful for removing tasks or notes that are no longer needed."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}".format(id=card_id_to_delete),  # noqa: UP032
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_card_property(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier of the Trello card to retrieve the property from."
    ],
    card_field_name: Annotated[
        str,
        "Specify which field of the Trello card to retrieve. Must be one of the predefined options such as 'id', 'name', 'url', etc.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id-field'."]:
    """Retrieve a specific field from a Trello card.

    Use this tool to get a specific property or detail of a Trello card by specifying the card ID and the field name you want to retrieve."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/{field}".format(id=card_id, field=card_field_name),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_card_actions(
    context: ToolContext,
    card_id: Annotated[str, "The unique identifier of the Trello card to fetch actions for."],
    action_type_filter: Annotated[
        str | None,
        "Comma-separated list of action types to filter the card actions. Refer to Trello's action types documentation for possible values.",  # noqa: E501
    ] = None,
    results_page_number: Annotated[
        float | None,
        "Specify the page number for the actions results. Each page returns 50 actions.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id-actions'."]:
    """Retrieve all actions performed on a specific Trello card.

    This tool retrieves a list of actions performed on a specified Trello card. It should be called when you need to analyze interactions or changes made to a card, such as comments, moves, or updates."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/actions".format(id=card_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "filter": action_type_filter,
            "page": results_page_number,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_card_attachments(
    context: ToolContext,
    card_id: Annotated[str, "The unique ID of the Trello card to retrieve attachments from."],
    attachment_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of attachment fields to retrieve. Determines which attachment details are returned for the card.",  # noqa: E501
    ] = None,
    restrict_to_cover_attachment: Annotated[
        str | None,
        "Specify 'cover' to limit results to only the cover attachment of the Trello card.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id-attachments'."]:
    """Retrieve attachments from a Trello card.

    Use this tool to get the list of all attachments associated with a specific Trello card. This is helpful when you need to manage or review files attached to your Trello tasks."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/attachments".format(id=card_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": attachment_fields,
            "filter": restrict_to_cover_attachment,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def add_attachment_to_trello_card(
    context: ToolContext,
    card_id: Annotated[
        str,
        "The unique identifier of the Trello card to which the attachment will be added. This is a required parameter.",  # noqa: E501
    ],
    attachment_name: Annotated[
        str | None,
        "The name of the attachment. Provide a descriptive title, maximum length 256 characters.",
    ] = None,
    attachment_file: Annotated[
        str | None,
        "The file to attach as multipart/form-data. Provide the file path or binary data.",
    ] = None,
    attachment_mime_type: Annotated[
        str | None, "The MIME type of the attachment. Example: 'image/png'. Max length 256."
    ] = None,
    attachment_url: Annotated[
        str | None, "A URL to attach to the Trello card, starting with `http://` or `https://`."
    ] = None,
    use_attachment_as_cover: Annotated[
        bool | None, "Set to true to use the new attachment as a cover for the card."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-cards-id-attachments'."]:
    """Add an attachment to a Trello card.

    This tool is used to attach a file or URL to a specific Trello card by its ID. It should be called when users need to add additional resources or files to a Trello card to enhance task management or provide context."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/attachments".format(id=card_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "name": attachment_name,
            "file": attachment_file,
            "mimeType": attachment_mime_type,
            "url": attachment_url,
            "setCover": use_attachment_as_cover,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_card_attachment_details(
    context: ToolContext,
    card_id: Annotated[str, "The unique identifier for the Trello card containing the attachment."],
    attachment_id: Annotated[str, "The unique ID of the attachment to fetch details for."],
    attachment_fields: Annotated[
        list[dict[str, str]] | None,
        "List of specific attachment fields to include in the response. Accepts an array of field names.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-cards-id-attachments-idattachment'."
]:
    """Retrieve specific attachment details from a Trello card.

    Use this tool to get detailed information about a specific attachment on a Trello card. It is useful when you need to fetch metadata or other properties of an attachment associated with a card."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/attachments/{idAttachment}".format(  # noqa: UP032
            id=card_id, idAttachment=attachment_id
        ),
        method="GET",
        params=remove_none_values({
            "fields": attachment_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_card_attachment(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier of the Trello card from which the attachment will be deleted."
    ],
    attachment_id_to_delete: Annotated[
        str, "The ID of the attachment you want to delete from the specified Trello card."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'deleted-cards-id-attachments-idattachment'."
]:
    """Delete an attachment from a Trello card.

    Use this tool to remove an attachment from a specified Trello card. It should be called when you need to delete an attachment from a card, identified by its card ID and attachment ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/attachments/{idAttachment}".format(  # noqa: UP032
            id=card_id, idAttachment=attachment_id_to_delete
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_card_board_info(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier for the Trello card whose board information is to be retrieved."
    ],
    board_field_selection: Annotated[
        str | None,
        '`all` or specify board fields as a comma-separated list (e.g., "name,desc") to retrieve.',
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id-board'."]:
    """Retrieve the board details for a specific Trello card.

    Use this tool to find out which board a specific Trello card belongs to. This can be helpful when organizing tasks or managing projects, ensuring you know the context of each card."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/board".format(id=card_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": board_field_selection,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_completed_checklist_items(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier of the Trello card to retrieve checklist item states."
    ],
    checklist_item_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of fields (`idCheckItem`, `state`) for the checklist items.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id-checkitemstates'."]:
    """Fetch the completed checklist items on a Trello card.

    Use this tool to get the completed checklist items for a specific Trello card. It retrieves the states of checklist items to see which ones are completed."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/checkItemStates".format(id=card_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": checklist_item_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_card_checklists(
    context: ToolContext,
    card_id: Annotated[
        str,
        "The unique ID of the Trello card for which to retrieve the checklists. Required for identifying the specific card.",  # noqa: E501
    ],
    include_check_items: Annotated[
        str | None,
        "Specify 'all' to include all checkItems or 'none' to exclude them on the card's checklists.",  # noqa: E501
    ] = None,
    checkitem_fields_selection: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of fields for checklist items: `name`, `nameData`, `pos`, `state`, `type`, `due`, `dueReminder`, `idMember`.",  # noqa: E501
    ] = None,
    include_all_checklists: Annotated[
        str | None, "Specify 'all' to retrieve all checklists or 'none' for none."
    ] = None,
    card_info_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of: 'idBoard, idCard, name, pos' for card fields to return.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id-checklists'."]:
    """Retrieve checklists from a specific Trello card.

    Use this tool to obtain all checklists associated with a particular card on Trello by providing the card ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/checklists".format(id=card_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "checkItems": include_check_items,
            "checkItem_fields": checkitem_fields_selection,
            "filter": include_all_checklists,
            "fields": card_info_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_checklist_on_card(
    context: ToolContext,
    card_id: Annotated[str, "The ID of the Trello card where the checklist will be created."],
    checklist_name: Annotated[str | None, "The name for the new checklist on the card."] = None,
    source_checklist_id: Annotated[
        str | None,
        "The ID of a source checklist to copy into the new one being created on the card.",
    ] = None,
    checklist_position_on_card: Annotated[
        str | None,
        "Specify the position of the checklist on the card. Can be 'top', 'bottom', or a positive number indicating the position.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-cards-id-checklists'."]:
    """Create a new checklist on a Trello card.

    This tool allows you to create a new checklist on a specified Trello card by providing the card ID. Use it to organize tasks or items within a card efficiently."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/checklists".format(id=card_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "name": checklist_name,
            "idChecklistSource": source_checklist_id,
            "pos": checklist_position_on_card,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_specific_checkitem_on_card(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier of the Trello card to retrieve the checkItem from."
    ],
    checkitem_id: Annotated[
        str, "The unique identifier of the checkItem to retrieve from the Trello card."
    ],
    checkitem_fields: Annotated[
        str | None,
        "Specify 'all' or provide a comma-separated list of attributes (e.g., 'name,pos,state').",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-cards-id-checkitem-idcheckitem'."
]:
    """Retrieve a specific checkItem from a Trello card.

    Use this tool to get details of a specific checkItem on a Trello card by providing the card and checkItem IDs."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/checkItem/{idCheckItem}".format(  # noqa: UP032
            id=card_id, idCheckItem=checkitem_id
        ),
        method="GET",
        params=remove_none_values({
            "fields": checkitem_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_trello_checklist_item(
    context: ToolContext,
    card_id: Annotated[str, "The unique ID of the Trello card that contains the checklist item."],
    checkitem_id: Annotated[
        str, "The unique ID of the checklist item to update on the Trello card."
    ],
    new_checklist_item_name: Annotated[
        str | None, "The new name for the checklist item in a Trello card."
    ] = None,
    checkitem_state: Annotated[
        str | None, "Specify the state of the checklist item, either `complete` or `incomplete`."
    ] = None,
    checklist_id: Annotated[
        str | None, "The unique ID of the checklist containing the item to update."
    ] = None,
    position: Annotated[
        str | None,
        "Position of the checklist item: `top`, `bottom`, or a numerical value for specific position.",  # noqa: E501
    ] = None,
    checkitem_due_date: Annotated[
        str | None, "A due date for the checklist item; expected format is a date string."
    ] = None,
    due_reminder_minutes: Annotated[
        float | None,
        "Specify the number of minutes before the due date when a reminder should be sent for the checkitem.",  # noqa: E501
    ] = None,
    member_id_to_remove: Annotated[
        str | None, "The ID of the member to remove from the Trello card checklist item."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-cards-id-checkitem-idcheckitem'."
]:
    """Update an item in a Trello card checklist.

    Use this tool to update a specific item within a checklist on a Trello card by providing the card and item identifiers."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/checkItem/{idCheckItem}".format(  # noqa: UP032
            id=card_id, idCheckItem=checkitem_id
        ),
        method="PUT",
        params=remove_none_values({
            "name": new_checklist_item_name,
            "state": checkitem_state,
            "idChecklist": checklist_id,
            "pos": position,
            "due": checkitem_due_date,
            "dueReminder": due_reminder_minutes,
            "idMember": member_id_to_remove,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_trello_checklist_item(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier for the Trello card from which to delete a checklist item."
    ],
    checkitem_id: Annotated[
        str, "The ID of the checklist item to be deleted from the Trello card."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-cards-id-checkitem-idcheckitem'."
]:
    """Delete a checklist item from a Trello card.

    Use this tool to delete a specific checklist item from a Trello card when given the card and checklist item IDs."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/checkItem/{idCheckItem}".format(  # noqa: UP032
            id=card_id, idCheckItem=checkitem_id
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_card_list(
    context: ToolContext,
    card_id: Annotated[str, "The unique identifier for the specific Trello card."],
    list_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of list fields to retrieve details about the Trello list a card belongs to.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id-list'."]:
    """Retrieve the list a specific Trello card belongs to.

    Use this tool to get details about the list in which a specific Trello card is located. It should be called when you need to identify or manage the list associated with a card in Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/list".format(id=card_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": list_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_card_members(
    context: ToolContext,
    card_id: Annotated[str, "The ID of the Trello card to get member information for."],
    member_fields: Annotated[
        str | None, "Specify 'all' or a comma-separated list of member fields to retrieve."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id-members'."]:
    """Retrieve members assigned to a specific Trello card.

    Use this tool to get details about the members associated with a specific Trello card by providing the card ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/members".format(id=card_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": member_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_card_voters(
    context: ToolContext,
    card_id: Annotated[str, "The ID of the Trello card to retrieve voters for."],
    member_fields: Annotated[
        str | None,
        "Specify 'all' or a list of member fields (e.g., 'fullName,username') to include in the response.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id-membersvoted'."]:
    """Retrieve members who voted on a Trello card.

    Use this tool to get a list of members who have voted on a specific Trello card by providing the card ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/membersVoted".format(id=card_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": member_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def vote_on_trello_card(
    context: ToolContext,
    member_id_to_vote_yes: Annotated[
        str, "The ID of the Trello member casting a 'yes' vote on the card."
    ],
    card_id: Annotated[str, "The unique ID of the Trello card where the vote will be cast."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'cardsidmembersvoted-1'."]:
    """Vote on a Trello card on behalf of a member.

    Use this tool to cast a vote on a specified Trello card for a specific member. It should be called when you need to register a member's vote on a card."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/membersVoted".format(id=card_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "value": member_id_to_vote_yes,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_card_plugin_data(
    context: ToolContext,
    card_id: Annotated[str, "The ID of the Trello card to retrieve shared plugin data for."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id-plugindata'."]:
    """Retrieve shared plugin data from a Trello card.

    This tool is called to get any shared pluginData associated with a specific Trello card. It should be used when there's a need to access additional plugin-related information stored on a card."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/pluginData".format(id=card_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_card_stickers(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier of the Trello card from which to retrieve stickers."
    ],
    sticker_fields: Annotated[
        str | None,
        "Specify 'all' to retrieve all sticker fields or provide a comma-separated list of specific sticker fields to retrieve.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id-stickers'."]:
    """Retrieve stickers from a Trello card.

    Use this tool to get all stickers placed on a specific Trello card by providing the card ID."""
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/stickers".format(id=card_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": sticker_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def add_sticker_to_card(
    context: ToolContext,
    sticker_identifier: Annotated[
        str,
        "For custom stickers, provide the sticker ID. For default stickers, provide the string identifier (e.g., 'taco-cool').",  # noqa: E501
    ],
    sticker_top_position: Annotated[
        float,
        "The vertical position of the sticker, ranging from -60 to 100, indicating how far from the top it should be placed.",  # noqa: E501
    ],
    sticker_left_position: Annotated[
        float, "Specify the left position of the sticker on the card, ranging from -60 to 100."
    ],
    sticker_z_index: Annotated[
        int, "The z-index/layer position of the sticker, affecting its stack order on the card."
    ],
    card_id: Annotated[
        str, "The unique identifier of the Trello card where the sticker will be added."
    ],
    sticker_rotation: Annotated[
        float | None, "The rotation angle of the sticker on the card, specified as a number."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-cards-id-stickers'."]:
    """Add a sticker to a specific Trello card.

    Use this tool to place a sticker on a specific Trello card by providing the card's ID. This is helpful for visually organizing or marking cards for emphasis."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/stickers".format(id=card_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "image": sticker_identifier,
            "top": sticker_top_position,
            "left": sticker_left_position,
            "zIndex": sticker_z_index,
            "rotate": sticker_rotation,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_card_sticker(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique ID of the Trello card from which to retrieve the sticker details."
    ],
    sticker_id: Annotated[str, "The unique identifier for the sticker on a Trello card."],
    sticker_fields: Annotated[
        str | None, "Specify 'all' or a comma-separated list of sticker fields to retrieve."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id-stickers-idsticker'."]:
    """Retrieve details of a specific sticker on a Trello card.

    Use this tool to get information about a specific sticker on a Trello card by providing the card and sticker identifiers."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/stickers/{idSticker}".format(  # noqa: UP032
            id=card_id, idSticker=sticker_id
        ),
        method="GET",
        params=remove_none_values({
            "fields": sticker_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def remove_card_sticker(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique ID of the Trello card from which the sticker will be removed."
    ],
    sticker_id: Annotated[str, "The ID of the sticker to be removed from the Trello card."],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-cards-id-stickers-idsticker'."
]:
    """Remove a sticker from a Trello card.

    Use this tool to remove a specific sticker from a Trello card by specifying the card and sticker IDs."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/stickers/{idSticker}".format(  # noqa: UP032
            id=card_id, idSticker=sticker_id
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_sticker_on_trello_card(
    context: ToolContext,
    sticker_top_position: Annotated[
        float, "The top position of the sticker, ranging from -60 to 100."
    ],
    left_position: Annotated[
        float, "The horizontal position of the sticker on the card, ranging from -60 to 100."
    ],
    sticker_z_index: Annotated[
        int, "Specifies the z-index of the sticker, determining its stacking order on the card."
    ],
    card_id: Annotated[
        str, "The unique identifier of the Trello card to which the sticker belongs."
    ],
    sticker_id: Annotated[
        str, "The unique identifier of the sticker to be updated on the Trello card."
    ],
    sticker_rotation_angle: Annotated[
        float | None,
        "Specify the rotation angle of the sticker. Expected values are numerical, representing the angle by which the sticker should be rotated.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-cards-id-stickers-idsticker'."]:
    """Update a sticker on a Trello card.

    Use this tool to update the details of a sticker on a specific Trello card by specifying the card and sticker identifiers."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/stickers/{idSticker}".format(  # noqa: UP032
            id=card_id, idSticker=sticker_id
        ),
        method="PUT",
        params=remove_none_values({
            "top": sticker_top_position,
            "left": left_position,
            "zIndex": sticker_z_index,
            "rotate": sticker_rotation_angle,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def edit_trello_comment(
    context: ToolContext,
    new_comment_text: Annotated[
        str, "The new text content for the Trello comment that needs to be updated."
    ],
    card_id: Annotated[
        str, "The unique identifier of the Trello card associated with the comment to update."
    ],
    comment_action_id: Annotated[
        str, "The unique ID of the comment action you want to update on the Trello card."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-cards-id-actions-idaction-comments'."
]:
    """Update an existing comment on a Trello card.

    Use this tool to update a comment in a Trello card's activity. It is useful when a user needs to correct or modify a comment previously made on a Trello card."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/actions/{idAction}/comments".format(  # noqa: UP032
            id=card_id, idAction=comment_action_id
        ),
        method="PUT",
        params=remove_none_values({
            "text": new_comment_text,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_trello_comment(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier of the Trello card from which the comment will be deleted."
    ],
    comment_action_id: Annotated[
        str, "The unique identifier for the comment action to be deleted on the Trello card."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-cards-id-actions-id-comments'."
]:
    """Delete a specific comment from a Trello card.

    Use this tool to delete a comment from a Trello card by providing the card and action IDs."""
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/actions/{idAction}/comments".format(  # noqa: UP032
            id=card_id, idAction=comment_action_id
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_card_custom_field_items(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier for the Trello card to retrieve custom field items."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-cards-id-customfielditems'."]:
    """Retrieve custom field items for a Trello card.

    Use this tool to obtain the custom field items associated with a specific Trello card. Useful for accessing card-specific data beyond the standard fields."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/customFieldItems".format(id=card_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def add_trello_card_comment(
    context: ToolContext,
    comment_text: Annotated[str, "The text of the comment to add to the Trello card."],
    card_id: Annotated[
        str, "The unique identifier of the Trello card to which the comment will be added."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-cards-id-actions-comments'."]:
    """Add a comment to a Trello card.

    This tool allows you to add a new comment to a specific Trello card. Use it when you need to append additional information or feedback to a card in Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/actions/comments".format(id=card_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "text": comment_text,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def add_label_to_card(
    context: ToolContext,
    card_id: Annotated[str, "The unique ID of the Trello card to which the label will be added."],
    label_id: Annotated[
        str | None,
        "The ID of the label to add to a Trello card. This is required to identify the specific label.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-cards-id-idlabels'."]:
    """Add a label to a Trello card.

    This tool adds a specified label to a given card in Trello. It is called when you need to organize or categorize a Trello card by attaching a label."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/idLabels".format(id=card_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "value": label_id,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def add_member_to_trello_card(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier of the Trello card to which a member will be added."
    ],
    member_id_to_add: Annotated[
        str | None, "The ID of the member to be added to the specified Trello card."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-cards-id-idmembers'."]:
    """Add a member to a Trello card.

    Use this tool to assign a member to a specific Trello card by providing the card ID."""
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/idMembers".format(id=card_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "value": member_id_to_add,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def add_label_to_trello_card(
    context: ToolContext,
    label_color: Annotated[
        str,
        "Specify a valid label color or `null`. Refer to Trello label options for valid colors.",
    ],
    card_id: Annotated[
        str, "The unique identifier for the Trello card you want to attach the label to."
    ],
    label_name: Annotated[
        str | None, "Specify the name for the new label to be created and added to the card."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-cards-id-labels'."]:
    """Create a label on a Trello board and attach it to a card.

    Use this tool to create a new label for a Trello board and add it to a specified card. This can help organize tasks and improve project management efficiency."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/labels".format(id=card_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "color": label_color,
            "name": label_name,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def mark_card_notifications_read(
    context: ToolContext,
    card_id: Annotated[
        str,
        "The unique identifier for the Trello card whose notifications you want to mark as read.",
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'post-cards-id-markassociatednotificationsread'.",
]:
    """Marks notifications for a specific card as read.

    Use this tool to mark all notifications associated with a specific Trello card as read. This is useful for keeping track of notifications and managing alerts efficiently."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/markAssociatedNotificationsRead".format(  # noqa: UP032
            id=card_id
        ),
        method="POST",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def remove_label_from_card(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier for the Trello card from which the label will be removed."
    ],
    label_id_to_remove: Annotated[
        str,
        "The ID of the label you want to remove from the Trello card. This ID is unique to each label.",  # noqa: E501
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-cards-id-idlabels-idlabel'."
]:
    """Remove a label from a Trello card.

    This tool is used to remove a specific label from a Trello card. It should be called when you need to unassign a label from a card in your Trello board. The tool confirms the successful removal of the label."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/idLabels/{idLabel}".format(  # noqa: UP032
            id=card_id, idLabel=label_id_to_remove
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def remove_member_from_card(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier of the Trello card from which the member will be removed."
    ],
    member_id_to_remove: Annotated[
        str,
        "The unique ID of the member you want to remove from the Trello card. This should match the Trello member ID format.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'delete-id-idmembers-idmember'."]:
    """Remove a member from a Trello card.

    Use this tool to remove a specific member from a Trello card based on the card ID and member ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/idMembers/{idMember}".format(  # noqa: UP032
            id=card_id, idMember=member_id_to_remove
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def remove_member_vote_from_card(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier of the Trello card from which to remove the vote."
    ],
    member_id_to_remove_vote: Annotated[
        str, "The ID of the member whose vote is to be removed from the Trello card."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-cards-id-membersvoted-idmember'."
]:
    """Remove a member's vote from a card on Trello.

    This tool is used to remove a specific member's vote from a card in Trello. It should be called when a member's vote needs to be deleted from a card."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/membersVoted/{idMember}".format(  # noqa: UP032
            id=card_id, idMember=member_id_to_remove_vote
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_checklist_item_on_card(
    context: ToolContext,
    card_id: Annotated[str, "The unique identifier for the Trello card containing the checklist."],
    checklist_item_id: Annotated[str, "The ID of the checklist item to update on a Trello card."],
    checklist_id: Annotated[str, "The ID of the checklist to update on the Trello card."],
    position_in_checklist: Annotated[
        str | None,
        "Specify the position of the item in the checklist: `top`, `bottom`, or a positive float indicating the precise position.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'put-cards-idcard-checklist-idchecklist-checkitem-idcheckitem'.",  # noqa: E501
]:
    """Update an item in a checklist on a Trello card.

    Use this tool to modify or update details of a specific item within a checklist on a Trello card. Ideal for tasks requiring checklist adjustments on project boards."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{idCard}/checklist/{idChecklist}/checkItem/{idCheckItem}".format(  # noqa: UP032
            idCard=card_id, idCheckItem=checklist_item_id, idChecklist=checklist_id
        ),
        method="PUT",
        params=remove_none_values({
            "pos": position_in_checklist,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_checklist_from_card(
    context: ToolContext,
    card_id: Annotated[
        str, "The unique identifier of the Trello card from which to delete the checklist."
    ],
    checklist_id_to_delete: Annotated[
        str, "The ID of the checklist to delete from the specified Trello card."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-cards-id-checklists-idchecklist'."
]:
    """Delete a checklist from a Trello card.

    Use this tool to delete a specific checklist from a given Trello card, identified by card and checklist IDs."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/cards/{id}/checklists/{idChecklist}".format(  # noqa: UP032
            id=card_id, idChecklist=checklist_id_to_delete
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_trello_checklist(
    context: ToolContext,
    card_id: Annotated[str, "The ID of the Trello card where the checklist will be added."],
    checklist_name: Annotated[
        str | None, "The name of the checklist. Must be between 1 and 16384 characters."
    ] = None,
    checklist_position: Annotated[
        str | None,
        "Specify the position of the checklist on the card: 'top', 'bottom', or a positive number for a specific placement.",  # noqa: E501
    ] = None,
    source_checklist_id: Annotated[
        str | None,
        "The ID of an existing checklist to copy into the new checklist. Use this to duplicate a checklist template or predefined checklist items.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-checklists'."]:
    """Create a checklist on a Trello card.

    Use this tool to create a new checklist on a specified Trello card. This can be useful for organizing tasks and ensuring all steps are accounted for within a card."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/checklists",
        method="POST",
        params=remove_none_values({
            "idCard": card_id,
            "name": checklist_name,
            "pos": checklist_position,
            "idChecklistSource": source_checklist_id,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_checklist_details(
    context: ToolContext,
    checklist_id: Annotated[str, "The unique identifier of the checklist to be retrieved."],
    card_visibility_filter: Annotated[
        str | None,
        "Specifies which cards associated with the checklist to include. Valid values are: `all`, `closed`, `none`, `open`, `visible`.",  # noqa: E501
    ] = None,
    check_items_to_return: Annotated[
        str | None, "Specify which check items to return: all or none."
    ] = None,
    checkitem_fields_to_return: Annotated[
        str | None,
        "Specify fields for checkItem details, using 'all' or a comma-separated list: 'name', 'nameData', 'pos', etc.",  # noqa: E501
    ] = None,
    include_checklist_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of checklist fields to return (e.g., 'name,pos,state'). Use this to retrieve specific fields from the checklist.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-checklists-id'."]:
    """Retrieve details of a specific Trello checklist.

    Call this tool to obtain details of a specific checklist in Trello using the checklist ID."""
    response = await make_request(
        url="https://api.trello.com/1/checklists/{id}".format(id=checklist_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "cards": card_visibility_filter,
            "checkItems": check_items_to_return,
            "checkItem_fields": checkitem_fields_to_return,
            "fields": include_checklist_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_trello_checklist(
    context: ToolContext,
    checklist_id: Annotated[str, "The unique identifier for the checklist to be updated."],
    checklist_name: Annotated[
        str | None,
        "Name of the checklist being created or updated. Must be between 1 and 16384 characters.",
    ] = None,
    checklist_position: Annotated[
        str | None,
        "Defines the position of the checklist on the card: 'top', 'bottom', or a positive number.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-checlists-id'."]:
    """Update an existing Trello checklist.

    Use this tool to update the details of an existing checklist on Trello. It is useful when modifications to the checklist content or status are required."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/checklists/{id}".format(id=checklist_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "name": checklist_name,
            "pos": checklist_position,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_trello_checklist(
    context: ToolContext,
    checklist_id: Annotated[str, "The unique ID of the checklist to be deleted from Trello."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'delete-checklists-id'."]:
    """Delete a checklist from Trello by its ID.

    Use this tool to remove a checklist from a Trello board by specifying the checklist's ID. Call this tool when you need to delete a checklist from a Trello card or board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/checklists/{id}".format(id=checklist_id),  # noqa: UP032
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_checklist_field(
    context: ToolContext,
    checklist_id: Annotated[
        str, "The unique identifier of the checklist to retrieve the field from."
    ],
    checklist_field_to_retrieve: Annotated[
        str, "Specify the field of the checklist to retrieve, such as 'name' or 'pos'."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-checklists-id-field'."]:
    """Retrieve a specific field from a Trello checklist.

    Call this tool to get detailed information about a specific field of a Trello checklist using its ID. Useful for retrieving particular attributes of a checklist, such as name, position, or IDCard."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/checklists/{id}/{field}".format(  # noqa: UP032
            id=checklist_id, field=checklist_field_to_retrieve
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_checklist_field(
    context: ToolContext,
    checklist_name_update_value: Annotated[
        str, "The new name for the checklist. Must be a string between 1 and 16384 characters."
    ],
    checklist_id: Annotated[str, "The unique identifier of the checklist to update."],
    field_to_update: Annotated[
        str, "Specify the checklist field to update, either 'name' or 'pos'."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-checklists-id-field'."]:
    """Update a specific field on a Trello checklist.

    Use this tool to update a specific field on a Trello checklist by providing the checklist ID and the field to be updated."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/checklists/{id}/{field}".format(  # noqa: UP032
            id=checklist_id, field=field_to_update
        ),
        method="PUT",
        params=remove_none_values({
            "value": checklist_name_update_value,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_board_for_checklist(
    context: ToolContext,
    checklist_id: Annotated[
        str, "The unique ID of the checklist whose board needs to be retrieved."
    ],
    board_fields_filter: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of board fields to retrieve. For example, 'name' or 'all'.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-checklists-id-board'."]:
    """Retrieve the board associated with a specific checklist.

    Use this tool to find out which board a specific checklist belongs to. Ideal for when you need to map a checklist back to its board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/checklists/{id}/board".format(id=checklist_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": board_fields_filter,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_card_by_checklist(
    context: ToolContext,
    checklist_id: Annotated[str, "The ID of the checklist to find its associated card."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-checklists-id-cards'."]:
    """Retrieve the card associated with a specific checklist.

    Use this tool to find which card a particular checklist belongs to in Trello. Call this when you have a checklist ID and need to determine the associated card."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/checklists/{id}/cards".format(id=checklist_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_checklist_items(
    context: ToolContext,
    checklist_id: Annotated[str, "The unique ID of the checklist to retrieve items from."],
    checkitem_filter: Annotated[
        str | None, "Filter the checkitems to include. Options: 'all', 'none'."
    ] = None,
    include_checkitem_fields: Annotated[
        str | None,
        "Specify which fields to include for checkitems, e.g., `all`, `name`, `pos`, etc.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-checklists-id-checkitems'."]:
    """Retrieve checkitems from a specified checklist.

    Use this tool to get all checkitems from a checklist on Trello by providing the checklist ID."""
    response = await make_request(
        url="https://api.trello.com/1/checklists/{id}/checkItems".format(id=checklist_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "filter": checkitem_filter,
            "fields": include_checkitem_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_checkitem_on_checklist(
    context: ToolContext,
    checkitem_name: Annotated[
        str,
        "The name of the new check item on the checklist. Must be between 1 and 16384 characters.",
    ],
    checklist_id: Annotated[
        str,
        "The unique identifier of the checklist to which the checkitem will be added. This should be a string.",  # noqa: E501
    ],
    checkitem_position: Annotated[
        str | None,
        "Specify the check item's position in the checklist as 'top', 'bottom', or a positive number.",  # noqa: E501
    ] = None,
    checkitem_due_date: Annotated[
        str | None, "Set the due date for the new checkitem. Use the format YYYY-MM-DD."
    ] = None,
    due_reminder_minutes: Annotated[
        float | None,
        "The number of minutes before the due date at which a reminder should be sent for the checkitem.",  # noqa: E501
    ] = None,
    member_id: Annotated[
        str | None, "The ID of a member resource to assign the checkitem to."
    ] = None,
    is_checkitem_checked: Annotated[
        bool | None,
        "Indicates if the check item is already marked as checked upon creation. Accepts a boolean value.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-checklists-id-checkitems'."]:
    """Add a checkitem to a specific checklist on Trello.

    Use this tool to add a new checkitem to an existing checklist on Trello by providing the checklist ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/checklists/{id}/checkItems".format(id=checklist_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "name": checkitem_name,
            "pos": checkitem_position,
            "checked": is_checkitem_checked,
            "due": checkitem_due_date,
            "dueReminder": due_reminder_minutes,
            "idMember": member_id,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_checklist_item(
    context: ToolContext,
    checklist_id: Annotated[str, "ID of the checklist from which to retrieve the checkitem."],
    check_item_id: Annotated[str, "ID of the check item to retrieve from the checklist."],
    checkitem_fields: Annotated[
        str | None,
        "Specify the checkitem fields to retrieve: `all`, `name`, `nameData`, `pos`, `state`, `type`, `due`, `dueReminder`, `idMember`.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-checklists-id-checkitems-idcheckitem'."
]:
    """Retrieve details of a specific checkitem from a checklist."""
    response = await make_request(
        url="https://api.trello.com/1/checklists/{id}/checkItems/{idCheckItem}".format(  # noqa: UP032
            id=checklist_id, idCheckItem=check_item_id
        ),
        method="GET",
        params=remove_none_values({
            "fields": checkitem_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def remove_checklist_item(
    context: ToolContext,
    checklist_id: Annotated[str, "ID of the checklist from which an item will be removed."],
    check_item_id: Annotated[str, "ID of the checklist item to remove in Trello."],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-checklists-id-checkitems-idcheckitem'."
]:
    """Removes an item from a Trello checklist.

    This tool removes a specified item from a checklist in Trello. Use it when you need to delete a checklist item."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/checklists/{id}/checkItems/{idCheckItem}".format(  # noqa: UP032
            id=checklist_id, idCheckItem=check_item_id
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_custom_field(
    context: ToolContext,
    custom_field_id: Annotated[
        str,
        "The unique identifier for the Trello custom field you want to retrieve. This ID is required to access specific details of the custom field.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-customfields-id'."]:
    """Retrieve details of a specific Trello custom field using its ID.

    Use this tool to obtain information about a custom field in Trello by providing its unique identifier. This is useful for accessing specific configurations or details of a custom field on a Trello board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/customFields/{id}".format(id=custom_field_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_custom_field(
    context: ToolContext,
    custom_field_id: Annotated[
        str, "The ID of the specific Custom Field to be deleted from a Trello board."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'delete-customfields-id'."]:
    """Delete a Custom Field from a Trello board.

    Use this tool to remove a specific custom field from a Trello board when it is no longer needed."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/customFields/{id}".format(id=custom_field_id),  # noqa: UP032
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def add_dropdown_option_trello(
    context: ToolContext,
    customfield_id: Annotated[
        str, "The unique identifier of the custom field to which a dropdown option will be added."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-customfields-id-options'."]:
    """Add an option to a Trello dropdown Custom Field.

    This tool is used to add an option to a dropdown Custom Field in Trello. It should be called when you need to expand the selection options available in a specific dropdown custom field."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/customFields/{id}/options".format(id=customfield_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_custom_field_options(
    context: ToolContext,
    custom_field_id: Annotated[str, "ID of the custom field to retrieve dropdown options."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-customfields-id-options'."]:
    """Retrieve options for a Trello dropdown custom field.

    Call this tool to get the available options for a specific dropdown custom field in Trello. Useful when you need to display or process the possible selections for a field by its ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/customFields/{id}/options".format(id=custom_field_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_dropdown_customfield_option(
    context: ToolContext,
    customfield_item_id: Annotated[
        str, "The ID of the custom field item to retrieve details from."
    ],
    customfield_option_id: Annotated[str, "ID of the dropdown custom field option to retrieve."],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-customfields-options-idcustomfieldoption'."
]:
    """Retrieve details of a specific dropdown Custom Field option.

    Use this tool to get information about a specific option within a dropdown-type Custom Field on Trello. It should be called when you need details of a particular option by its ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/customFields/{id}/options/{idCustomFieldOption}".format(  # noqa: UP032
            id=customfield_item_id, idCustomFieldOption=customfield_option_id
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_customfield_option(
    context: ToolContext,
    customfield_item_id: Annotated[
        str, "The ID of the custom field item from which the option will be deleted."
    ],
    custom_field_option_id: Annotated[str, "ID of the custom field option to delete."],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'delete-customfields-options-idcustomfieldoption'.",
]:
    """Delete an option from a Custom Field dropdown on Trello.

    Use this tool to remove a specific option from a Custom Field dropdown in Trello. Ideal for maintaining updates or cleaning up unnecessary options."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/customFields/{id}/options/{idCustomFieldOption}".format(  # noqa: UP032
            id=customfield_item_id, idCustomFieldOption=custom_field_option_id
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_available_emoji(
    context: ToolContext,
    locale: Annotated[
        str | None,
        "The locale for emoji descriptions and names. Defaults to the logged-in member's locale.",
    ] = None,
    include_spritesheet_urls: Annotated[
        bool | None, "Set to true to include spritesheet URLs in the response."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'emoji'."]:
    """Retrieve a list of available emojis from Trello.

    This tool is used to call the Trello API to retrieve a list of all available emojis. It should be called when there's a need to access or display the available emoji options within Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/emoji",
        method="GET",
        params=remove_none_values({
            "locale": locale,
            "spritesheets": include_spritesheet_urls,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_enterprise_by_id(
    context: ToolContext,
    enterprise_id: Annotated[
        str, "The unique ID of the enterprise to retrieve details for from Trello."
    ],
    enterprise_fields_to_retrieve: Annotated[
        str | None,
        "Comma-separated list of fields to retrieve, such as `id`, `name`, `displayName`, etc.",
    ] = None,
    member_inclusion_type: Annotated[
        str | None, "Specify the type of members to include: none, normal, admins, owners, or all."
    ] = None,
    member_fields: Annotated[
        str | None,
        "Specify one member attribute to include: `avatarHash`, `fullName`, `initials`, or `username`.",  # noqa: E501
    ] = None,
    member_filter_query: Annotated[
        str | None,
        "A SCIM-style query to filter members. Overrides the normal/admins value of members.",
    ] = None,
    member_sort_value: Annotated[
        str | None,
        "Provide a SCIM-style sorting value. Prefix with '-' for descending order; default is ascending.",  # noqa: E501
    ] = None,
    member_sort: Annotated[
        str | None,
        "SCIM-style sort value for members. Use `-` prefix to sort descending. Note: members array may be paginated.",  # noqa: E501
    ] = None,
    deprecated_member_sort_order: Annotated[
        str | None,
        "Deprecated parameter for sorting members. Use 'member_sort' instead. Accepts: `ascending`, `descending`, `asc`, `desc`.",  # noqa: E501
    ] = None,
    member_start_index: Annotated[
        int | None,
        "An integer between 0 and 100 specifying the starting index for paginated member results.",
    ] = None,
    member_count: Annotated[
        int | None, "Specify the number of members to retrieve, ranging from 0 to 100."
    ] = None,
    organization_visibility_filter: Annotated[
        str | None,
        "Specify the level of visibility for the organizations. Options are: `none`, `members`, `public`, `all`.",  # noqa: E501
    ] = None,
    organization_fields: Annotated[
        str | None,
        "Specify fields related to organizations to retrieve. Use values accepted by nested organization field resource.",  # noqa: E501
    ] = None,
    organization_memberships_filter: Annotated[
        str | None,
        "Comma-separated list of workspace memberships to include, such as 'me', 'normal', 'admin', 'active', 'deactivated'.",  # noqa: E501
    ] = None,
    include_paid_account_information: Annotated[
        bool | None, "Include paid account information in the returned workspace objects if true."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-enterprises-id'."]:
    """Retrieve details of an enterprise by its ID.

    Use this tool to retrieve information about a specific enterprise in Trello using its ID."""
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}".format(id=enterprise_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": enterprise_fields_to_retrieve,
            "members": member_inclusion_type,
            "member_fields": member_fields,
            "member_filter": member_filter_query,
            "member_sort": member_sort_value,
            "member_sortBy": member_sort,
            "member_sortOrder": deprecated_member_sort_order,
            "member_startIndex": member_start_index,
            "member_count": member_count,
            "organizations": organization_visibility_filter,
            "organization_fields": organization_fields,
            "organization_paid_accounts": include_paid_account_information,
            "organization_memberships": organization_memberships_filter,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_enterprise_audit_log(
    context: ToolContext,
    enterprise_id: Annotated[
        str, "ID of the enterprise whose audit log actions are to be retrieved."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-enterprises-id-auditlog'."]:
    """Retrieve actions from an enterprise's audit log.

    Fetches an array of actions related to an Enterprise object for audit purposes from Trello's audit log. Useful for analyzing enterprise activities and administrative changes."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/auditlog".format(id=enterprise_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_enterprise_admins(
    context: ToolContext,
    enterprise_id: Annotated[
        str, "The unique ID of the enterprise whose admin members you want to retrieve."
    ],
    member_fields: Annotated[
        str | None,
        "Specify the fields to be included in the response for each admin member. These should match valid values that the nested member field resource accepts.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-enterprises-id-admins'."]:
    """Retrieve admin members of a specified enterprise.

    Use this tool to obtain the list of admin members for a given enterprise, identified by its ID. This is helpful for managing or viewing enterprise administrative access."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/admins".format(id=enterprise_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": member_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_enterprise_signup_url(
    context: ToolContext,
    enterprise_id: Annotated[
        str, "The unique ID of the Trello enterprise for which you want to retrieve the signup URL."
    ],
    redirect_url: Annotated[
        str | None, "Any valid URL to which the user will be redirected after signup."
    ] = None,
    require_authentication: Annotated[
        bool | None,
        "Specifies if authentication is needed to access the signup URL. True means authentication is required.",  # noqa: E501
    ] = None,
    has_user_accepted_confirmation: Annotated[
        bool | None,
        "Indicates if the user has acknowledged the confirmation before being redirected. Set to True if confirmed.",  # noqa: E501
    ] = None,
    tos_accepted: Annotated[
        bool | None,
        "Indicate if the user has seen and consented to the Trello ToS before redirection.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-enterprises-id-signupurl'."]:
    """Retrieve the signup URL for a specific enterprise on Trello.

    Use this tool to get the signup URL for a specific Trello enterprise. This can be useful when you need to invite new users to join an enterprise on Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/signupUrl".format(id=enterprise_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "authenticate": require_authentication,
            "confirmationAccepted": has_user_accepted_confirmation,
            "returnUrl": redirect_url,
            "tosAccepted": tos_accepted,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_enterprise_users(
    context: ToolContext,
    enterprise_id: Annotated[
        str, "The unique identifier of the Trello enterprise to retrieve users from."
    ],
    active_since_date: Annotated[
        str | None, "Return only users active since this date (inclusive). Format: YYYY-MM-DD."
    ] = None,
    inactive_since_date: Annotated[
        str | None,
        "Returns only Trello users active since this date (inclusive). Provide the date in YYYY-MM-DD format.",  # noqa: E501
    ] = None,
    search_value_filter: Annotated[
        str | None, "Filter users by email address or full name starting with this value."
    ] = None,
    pagination_cursor: Annotated[
        str | None,
        "Cursor for returning the next set of results in a paginated response. Use the cursor from the response to fetch subsequent batches.",  # noqa: E501
    ] = None,
    licensed_members_only: Annotated[
        bool | None,
        "If true, return only members with a Trello license. If false, return only those without a license. If omitted, return both.",  # noqa: E501
    ] = None,
    return_deactivated_members: Annotated[
        bool | None,
        "Return deactivated members when true; active members when false. Unspecified returns all members.",  # noqa: E501
    ] = None,
    include_collaborators: Annotated[
        bool | None,
        "Set to true to include members who are board guests (without a license). False excludes them. If unspecified, both are returned.",  # noqa: E501
    ] = None,
    return_managed_members: Annotated[
        bool | None,
        "Set to true to return only members managed by the Trello Enterprise, false to exclude managed members. If not set, both are returned.",  # noqa: E501
    ] = None,
    include_administrators_only: Annotated[
        bool | None,
        "If true, returns only administrators of the Trello Enterprise. If false, returns only non-administrators. If unspecified, returns both.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-users-id'."]:
    """Retrieve users from a Trello enterprise, with optional filters.

    Use this tool to get information about users in a Trello enterprise, such as licensed members or board guests. The response is paginated, providing up to 100 users per request."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/members/query".format(id=enterprise_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "licensed": licensed_members_only,
            "deactivated": return_deactivated_members,
            "collaborator": include_collaborators,
            "managed": return_managed_members,
            "admin": include_administrators_only,
            "activeSince": active_since_date,
            "inactiveSince": inactive_since_date,
            "search": search_value_filter,
            "cursor": pagination_cursor,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_enterprise_members(
    context: ToolContext,
    enterprise_id: Annotated[
        str,
        "ID of the enterprise whose members are to be retrieved. This is required to specify which enterprise's members you want to access.",  # noqa: E501
    ],
    member_fields: Annotated[
        str | None, "Comma-separated list of valid member fields to retrieve."
    ] = None,
    scim_filter_query: Annotated[
        str | None,
        "SCIM-style query to filter members. Overrides member type filters and controls pagination.",  # noqa: E501
    ] = None,
    sort_members: Annotated[
        str | None,
        "SCIM-style sorting value. Prefix with '-' for descending order; otherwise, it's ascending.",  # noqa: E501
    ] = None,
    sort_criteria: Annotated[
        str | None,
        "Sorting option for members. Use 'sort' parameter instead, following SCIM-style sorting. Deprecated parameter.",  # noqa: E501
    ] = None,
    sort_order_for_listing: Annotated[
        str | None,
        "Defines the order for sorting members. Use values: 'ascending', 'descending', 'asc', or 'desc'. Deprecated: Prefer 'sort'.",  # noqa: E501
    ] = None,
    member_start_index: Annotated[
        int | None, "An integer between 0 and 9999 indicating where to start retrieving members."
    ] = None,
    member_count_filter: Annotated[
        str | None, "Apply a SCIM-style filter to specify the number of members to retrieve."
    ] = None,
    organization_fields: Annotated[
        str | None,
        "Specify valid values for nested organization fields to retrieve specific organization-related data.",  # noqa: E501
    ] = None,
    included_board_fields: Annotated[
        str | None,
        "Comma-separated list of values accepted by the nested board resource to specify included fields.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-enterprises-id-members'."]:
    """Retrieve members of a specified enterprise on Trello.

    Use this tool to get a list of members associated with a particular enterprise by providing the enterprise ID. This is useful for managing team members or reviewing enterprise membership details."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/members".format(id=enterprise_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": member_fields,
            "filter": scim_filter_query,
            "sort": sort_members,
            "sortBy": sort_criteria,
            "sortOrder": sort_order_for_listing,
            "startIndex": member_start_index,
            "count": member_count_filter,
            "organization_fields": organization_fields,
            "board_fields": included_board_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_enterprise_member_by_id(
    context: ToolContext,
    enterprise_id: Annotated[
        str, "The ID of the enterprise from which to retrieve the member information."
    ],
    member_id: Annotated[str, "The unique ID of the enterprise member to retrieve details for."],
    member_fields: Annotated[
        str | None,
        "A comma-separated list of fields to retrieve for the member. Accepts any valid values from the nested member field resource.",  # noqa: E501
    ] = None,
    organization_fields: Annotated[
        str | None,
        "Specify which organization fields to retrieve, using valid organization field resource identifiers.",  # noqa: E501
    ] = None,
    board_fields_for_enterprise_member: Annotated[
        str | None, "Comma-separated values specifying board fields for a member of an enterprise."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-enterprises-id-members-idmember'."
]:
    """Retrieve a specific enterprise member's details by ID.

    This tool retrieves details of a specific member within an enterprise using their ID. It should be called when you need information about an enterprise member, provided the enterprise ID and member ID are known."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/members/{idMember}".format(  # noqa: UP032
            id=enterprise_id, idMember=member_id
        ),
        method="GET",
        params=remove_none_values({
            "fields": member_fields,
            "organization_fields": organization_fields,
            "board_fields": board_fields_for_enterprise_member,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def check_org_transferability(
    context: ToolContext,
    enterprise_id: Annotated[str, "ID of the Enterprise for which to check transferability."],
    organization_id: Annotated[
        str, "The ID of the Organization resource to check for transfer eligibility."
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'get-enterprises-id-transferrable-organization-idOrganization'.",  # noqa: E501
]:
    """Check if an organization can be transferred to an enterprise.

    Use this tool to determine whether a specific organization is eligible for transfer to a certain enterprise."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/transferrable/organization/{idOrganization}".format(  # noqa: UP032
            id=enterprise_id, idOrganization=organization_id
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_transferrable_organizations(
    context: ToolContext,
    enterprise_id: Annotated[
        str, "The ID of the enterprise for which to retrieve transferrable organizations."
    ],
    organization_ids: Annotated[
        list[dict[str, str]],
        "An array of organization IDs to check for transferability to an enterprise.",
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'get-enterprises-id-transferrable-bulk-idOrganizations'.",
]:
    """Retrieve organizations transferrable to an enterprise.

    Fetches a list of organizations that can be transferred to an enterprise, given a bulk list of organization IDs. Use this tool to identify which organizations can be moved to a specified enterprise."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/transferrable/bulk/{idOrganizations}".format(  # noqa: UP032
            id=enterprise_id, idOrganizations=organization_ids
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def decline_enterprise_join_requests(
    context: ToolContext,
    organization_ids: Annotated[
        list[dict[str, str]], "An array of organization IDs to decline join requests for."
    ],
    enterprise_id: Annotated[
        str, "The ID of the enterprise for which join requests should be declined."
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'put-enterprises-id-enterpriseJoinRequest-bulk'.",
]:
    """Decline multiple enterprise join requests for organizations.

    This tool declines enterprise join requests for one or multiple organizations in a Trello enterprise. It should be used when you need to reject several join requests at once."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/${id}/enterpriseJoinRequest/bulk".format(  # noqa: UP032
            id=enterprise_id
        ),
        method="PUT",
        params=remove_none_values({
            "idOrganizations": organization_ids,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_claimable_workspaces(
    context: ToolContext,
    enterprise_id: Annotated[str, "ID of the enterprise to retrieve claimable workspaces for."],
    workspace_limit: Annotated[
        int | None,
        "Limits the number of workspaces returned in the query. Use an integer value to specify the maximum number.",  # noqa: E501
    ] = None,
    sort_order_cursor: Annotated[
        str | None,
        "Specifies the sort order for returning matching documents by setting a cursor position.",
    ] = None,
    enterprise_name: Annotated[
        str | None, "Name of the enterprise to retrieve claimable workspaces for."
    ] = None,
    active_since_date: Annotated[
        str | None, "Date in YYYY-MM-DD format to search up to for active workspaces."
    ] = None,
    inactive_since_date: Annotated[
        str | None, "Date in YYYY-MM-DD format for filtering workspaces inactive up to this date."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-enterprises-id-claimableOrganizations'."
]:
    """Retrieve claimable workspaces for an enterprise by ID.

    Use this tool to get the list of workspaces that can be claimed by a specific enterprise, optionally filtering by active or inactive status."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/claimableOrganizations".format(  # noqa: UP032
            id=enterprise_id
        ),
        method="GET",
        params=remove_none_values({
            "limit": workspace_limit,
            "cursor": sort_order_cursor,
            "name": enterprise_name,
            "activeSince": active_since_date,
            "inactiveSince": inactive_since_date,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_pending_enterprise_workspaces(
    context: ToolContext,
    enterprise_id: Annotated[str, "ID of the enterprise for which to retrieve pending workspaces."],
    active_since_date: Annotated[
        str | None, "Date in YYYY-MM-DD format to search for active workspaces up to this date."
    ] = None,
    inactive_until_date: Annotated[
        str | None, "Specify the date (YYYY-MM-DD) to search up to for workspace inactiveness."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-enterprises-id-pendingOrganizations'."
]:
    """Retrieve pending workspaces for an enterprise by ID.

    Use this tool to get a list of workspaces that are pending approval for a specific enterprise. It is useful when managing enterprise-level organization and pending requests."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/pendingOrganizations".format(  # noqa: UP032
            id=enterprise_id
        ),
        method="GET",
        params=remove_none_values({
            "activeSince": active_since_date,
            "inactiveSince": inactive_until_date,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_enterprise_auth_token(
    context: ToolContext,
    enterprise_id: Annotated[
        str, "ID of the enterprise for which you want to create an auth token."
    ],
    token_expiration: Annotated[
        str | None, "Specify token expiration duration: `1hour`, `1day`, `30days`, or `never`."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-enterprises-id-tokens'."]:
    """Create an auth token for a Trello enterprise.

    Use this tool to generate an authentication token for a specified Trello enterprise. It is typically called when access to enterprise-level features is required."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/tokens".format(id=enterprise_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "expiration": token_expiration,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def transfer_org_to_enterprise(
    context: ToolContext,
    organization_id_to_transfer: Annotated[
        str,
        "ID of the organization that needs to be transferred to the enterprise. It is required for initiating the transfer process.",  # noqa: E501
    ],
    enterprise_id: Annotated[
        str, "ID of the Enterprise to which the organization will be transferred."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-enterprises-id-organizations'."
]:
    """Transfer an organization to an enterprise.

    Use this tool to initiate the transfer of an organization to an enterprise. It is useful for enterprises using AdminHub for user management; the addition will be completed asynchronously. A successful call only confirms the request was received."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/organizations".format(id=enterprise_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "idOrganization": organization_id_to_transfer,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_member_license_status(
    context: ToolContext,
    enterprise_id: Annotated[
        str,
        "The unique ID of the enterprise. Required to specify which enterprise the member's license status will be updated for.",  # noqa: E501
    ],
    member_id: Annotated[
        str, "The unique identifier of the member whose license status is being updated."
    ],
    grant_enterprise_license: Annotated[
        bool,
        "Boolean to specify if the user should be granted an Enterprise license (true) or not (false).",  # noqa: E501
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-enterprises-id-members-idmember-licensed'."
]:
    """Update a member's license status in an enterprise.

    Use this tool to update whether a member should utilize one of an enterprise's available licenses. Note that revoking a license will deactivate the member within the enterprise. This operation is not available for enterprises using AdminHub for user management."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/members/{idMember}/licensed".format(  # noqa: UP032
            id=enterprise_id, idMember=member_id
        ),
        method="PUT",
        params=remove_none_values({
            "value": grant_enterprise_license,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def deactivate_enterprise_member(
    context: ToolContext,
    enterprise_id: Annotated[str, "The ID of the enterprise from which to deactivate a member."],
    member_id_to_deactivate: Annotated[str, "ID of the member to deactivate in the enterprise."],
    user_deactivation_status: Annotated[
        bool, "Set to true to deactivate the user; false keeps them active."
    ],
    member_field_values: Annotated[
        str | None,
        "Comma-separated list of valid member field values, currently only 'id' is supported.",
    ] = None,
    organization_field: Annotated[
        str | None, "Specify the organization attribute to retrieve, such as 'id' or 'name'."
    ] = None,
    board_field_values: Annotated[
        str | None,
        "A comma-separated list of fields related to the board resource, such as 'id', 'name', or 'url'.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'enterprises-id-members-idMember-deactivated'."
]:
    """Deactivate a member from an enterprise on Trello.

    Deactivate an enterprise member on Trello, unless the enterprise uses AdminHub for user management."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/members/{idMember}/deactivated".format(  # noqa: UP032
            id=enterprise_id, idMember=member_id_to_deactivate
        ),
        method="PUT",
        params=remove_none_values({
            "value": user_deactivation_status,
            "fields": member_field_values,
            "organization_fields": organization_field,
            "board_fields": board_field_values,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def make_trello_member_enterprise_admin(
    context: ToolContext,
    enterprise_id: Annotated[
        str, "The unique ID of the enterprise for which a member is being made an admin."
    ],
    member_id_to_promote: Annotated[str, "ID of the member to be made an admin of the enterprise."],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-enterprises-id-admins-idmember'."
]:
    """Promote a member to an enterprise admin in Trello.

    Use this tool to make a Trello member an admin of a specified enterprise. Note: This action is not available for enterprises using AdminHub for user management."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/admins/{idMember}".format(  # noqa: UP032
            id=enterprise_id, idMember=member_id_to_promote
        ),
        method="PUT",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def remove_enterprise_admin(
    context: ToolContext,
    enterprise_id: Annotated[str, "The ID of the Enterprise from which the admin will be removed."],
    member_id_to_remove_admin: Annotated[
        str, "The unique ID of the member to remove as an admin from the enterprise."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'enterprises-id-organizations-idmember'."
]:
    """Remove a member as admin from a Trello enterprise.

    Use this tool to remove a member's admin rights from an enterprise in Trello. Note that this action is not available for enterprises using AdminHub for user management."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/admins/{idMember}".format(  # noqa: UP032
            id=enterprise_id, idMember=member_id_to_remove_admin
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def remove_organization_from_enterprise(
    context: ToolContext,
    enterprise_id: Annotated[
        str, "The unique ID of the enterprise from which you want to remove the organization."
    ],
    organization_id_to_remove: Annotated[
        str, "The ID of the organization to be removed from the specified enterprise."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-enterprises-id-organizations-idorg'."
]:
    """Remove an organization from an enterprise.

    Use this tool to remove an organization from a specified enterprise in Trello."""
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/organizations/{idOrg}".format(  # noqa: UP032
            id=enterprise_id, idOrg=organization_id_to_remove
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def add_organizations_to_enterprise(
    context: ToolContext,
    enterprise_id: Annotated[
        str, "The ID of the enterprise to which organizations are being added."
    ],
    organization_ids_to_add: Annotated[
        list[dict[str, str]], "An array of organization IDs to be added to the enterprise."
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'get-enterprises-id-organizations-bulk-idOrganizations'.",
]:
    """Add multiple organizations to an enterprise.

    Use this tool to add an array of organizations to a Trello enterprise. This operation is asynchronous for enterprises using AdminHub for user management. A successful call returns a 200 status, indicating the receipt of the request but not the completion of the process."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/enterprises/{id}/organizations/bulk/{idOrganizations}".format(  # noqa: UP032
            id=enterprise_id, idOrganizations=organization_ids_to_add
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_label_info(
    context: ToolContext,
    label_id: Annotated[
        str, "The unique identifier of the Trello label to retrieve information for."
    ],
    fields_included_in_response: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of field names to include in the response.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-labels-id'."]:
    """Retrieve detailed information about a specific Trello label.

    Use this tool to get details of a specific label in Trello by providing the label ID."""
    response = await make_request(
        url="https://api.trello.com/1/labels/{id}".format(id=label_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": fields_included_in_response,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_trello_label(
    context: ToolContext,
    label_id: Annotated[str, "The unique ID of the Trello label to update."],
    new_label_name: Annotated[
        str | None, "The new name for the Trello label to be updated."
    ] = None,
    new_label_color: Annotated[
        str | None,
        "The desired new color for the Trello label. Choose from options: yellow, purple, blue, red, green, orange, black, sky, pink, lime.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-labels-id'."]:
    """Update a Trello label by its ID.

    Use this tool to update the details of a specific Trello label using its ID. Useful for changing label attributes such as name or color."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/labels/{id}".format(id=label_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "name": new_label_name,
            "color": new_label_color,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_trello_label(
    context: ToolContext,
    label_id: Annotated[str, "The unique ID of the Trello label to be deleted."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'delete-labels-id'."]:
    """Delete a Trello label by its ID.

    Use this tool to remove a specific label from Trello by providing its ID. It should be called when a user wants to delete a label that is no longer needed."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/labels/{id}".format(id=label_id),  # noqa: UP032
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_trello_label_field(
    context: ToolContext,
    new_field_value: Annotated[
        str, "The new value to update the specified field on the Trello label."
    ],
    label_id: Annotated[str, "The ID of the Trello label to be updated."],
    label_field_to_update: Annotated[
        str, "Specify the field (e.g., 'color' or 'name') on the Trello label to update."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-labels-id-field'."]:
    """Update a specific field on a Trello label.

    Use this tool to update a specific field, such as name or color, on a Trello label by providing the label ID and the field to be updated."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/labels/{id}/{field}".format(  # noqa: UP032
            id=label_id, field=label_field_to_update
        ),
        method="PUT",
        params=remove_none_values({
            "value": new_field_value,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_trello_label(
    context: ToolContext,
    label_name: Annotated[str, "Name for the label to be created on the Trello board."],
    label_color: Annotated[
        str,
        "Specifies the color for the label. Accepted values are: yellow, purple, blue, red, green, orange, black, sky, pink, lime.",  # noqa: E501
    ],
    board_id: Annotated[str, "The unique ID of the Trello board where the label will be created."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-labels'."]:
    """Create a new label on a Trello board.

    Use this tool to add a new label to a specific board in Trello. Ideal for organizing and categorizing tasks on your board by creating custom labels."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/labels",
        method="POST",
        params=remove_none_values({
            "name": label_name,
            "color": label_color,
            "idBoard": board_id,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_list_info(
    context: ToolContext,
    list_id: Annotated[
        str, "The unique identifier for the Trello list to retrieve information for."
    ],
    list_field_names: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of field names to retrieve details for a Trello list.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-lists-id'."]:
    """Retrieve detailed information about a specific Trello list.

    Use this tool to get detailed information about a Trello list by its ID. Ideal for managing and reviewing list-specific data within Trello boards."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/lists/{id}".format(id=list_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": list_field_names,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_trello_list(
    context: ToolContext,
    list_id: Annotated[str, "The ID of the Trello list to update."],
    new_list_name: Annotated[str | None, "The new name to set for the Trello list."] = None,
    destination_board_id: Annotated[
        str | None,
        "ID of the board where the list should be moved. This allows you to relocate the list to a different board.",  # noqa: E501
    ] = None,
    list_new_position: Annotated[
        str | None,
        "New position for the list: 'top', 'bottom', or a positive floating point number. Determines where the list should be placed on the board.",  # noqa: E501
    ] = None,
    archive_list: Annotated[
        bool | None, "Set to true to archive (close) the list, false to keep it open."
    ] = None,
    member_subscribed: Annotated[
        bool | None,
        "Indicates if the active member is subscribed to the list. Use true for subscribed, false for not subscribed.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-lists-id'."]:
    """Updates properties of a Trello list.

    This tool updates the properties of a specified Trello list when changes are needed, such as modifying its name or position."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/lists/{id}".format(id=list_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "name": new_list_name,
            "closed": archive_list,
            "idBoard": destination_board_id,
            "pos": list_new_position,
            "subscribed": member_subscribed,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_trello_board_list(
    context: ToolContext,
    list_name: Annotated[str, "The name of the list to be created on the Trello board."],
    board_id: Annotated[str, "The ID of the Trello board where the new list will be created."],
    source_list_id: Annotated[
        str | None, "ID of the list to copy into the new list to replicate its content."
    ] = None,
    list_position: Annotated[
        str | None,
        "Specifies where the new list will be positioned on the board. Accepts 'top', 'bottom', or a positive floating point number to indicate a specific position.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-lists'."]:
    """Create a new list on a Trello board.

    Use this tool to add a new list to an existing Trello board. Ideal for organizing tasks or projects by creating distinct categories or phases."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/lists",
        method="POST",
        params=remove_none_values({
            "name": list_name,
            "idBoard": board_id,
            "idListSource": source_list_id,
            "pos": list_position,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def archive_all_cards_in_list(
    context: ToolContext,
    list_id: Annotated[str, "The ID of the Trello list to archive all cards from."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-lists-id-archiveallcards'."]:
    """Archive all cards in a specified Trello list.

    Use this tool to archive every card in a specified Trello list. It is useful for organizing cards and clearing lists once they are no longer needed."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/lists/{id}/archiveAllCards".format(id=list_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def move_all_cards_in_list(
    context: ToolContext,
    target_board_id: Annotated[str, "The ID of the board to which the cards should be moved."],
    target_list_id: Annotated[str, "The ID of the Trello list where the cards should be moved to."],
    source_list_id: Annotated[str, "The unique ID of the list to move all cards from in Trello."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-lists-id-moveallcards'."]:
    """Move all cards from one Trello list to another.

    Use this tool to move all cards from a specified list in Trello to another list. It's useful for reorganizing tasks or consolidating workflows within a Trello board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/lists/{id}/moveAllCards".format(id=source_list_id),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "idBoard": target_board_id,
            "idList": target_list_id,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def archive_unarchive_list_trello(
    context: ToolContext,
    list_id: Annotated[str, "The ID of the Trello list to archive or unarchive."],
    archive_list: Annotated[
        str | None, "Set to true to archive the list, false to unarchive."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-lists-id-closed'."]:
    """Toggle a list's archived status in Trello.

    Use this tool to archive or unarchive a list in Trello by specifying its ID. This is useful for organizing boards by managing list visibility."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/lists/{id}/closed".format(id=list_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "value": archive_list,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def move_list_to_board(
    context: ToolContext,
    target_board_id: Annotated[str, "The ID of the board where the list will be moved."],
    list_id: Annotated[str, "The unique ID of the Trello list to be moved to another board."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-id-idboard'."]:
    """Transfer a Trello list to another board.

    Use this tool to move a specific list from its current board to a different board on Trello. Ideal for organizing tasks and managing projects across boards efficiently."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/lists/{id}/idBoard".format(id=list_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "value": target_board_id,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def rename_trello_list(
    context: ToolContext,
    list_id: Annotated[str, "The unique identifier of the Trello list to be renamed."],
    list_field_to_update: Annotated[
        str, "Specify the list field to update, e.g., 'name', 'pos', or 'subscribed'."
    ],
    new_list_name: Annotated[
        str | None, "The new name for the Trello list you want to apply."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-lists-id-field'."]:
    """Rename a list on Trello using its ID and field.

    Use this tool to rename a list on Trello by specifying the list ID and desired field name."""
    response = await make_request(
        url="https://api.trello.com/1/lists/{id}/{field}".format(  # noqa: UP032
            id=list_id, field=list_field_to_update
        ),
        method="PUT",
        params=remove_none_values({
            "value": new_list_name,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_list_actions(
    context: ToolContext,
    list_id: Annotated[str, "The unique identifier of the Trello list to retrieve actions for."],
    action_type_filter: Annotated[
        str | None,
        "A comma-separated list of action types to filter the actions retrieved from a Trello list.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-lists-id-actions'."]:
    """Retrieve actions performed on a specific Trello list.

    Use this tool to get all actions taken on a given Trello list by specifying the list ID."""
    response = await make_request(
        url="https://api.trello.com/1/lists/{id}/actions".format(id=list_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "filter": action_type_filter,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_board_by_list_id(
    context: ToolContext,
    list_id: Annotated[str, "The unique ID of the list to find its associated board."],
    board_fields: Annotated[
        str | None, "Specify 'all' or a comma-separated list of board fields to retrieve."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-lists-id-board'."]:
    """Retrieve the board for a specified list ID in Trello.

    This tool retrieves the details of the board that a specific list belongs to in Trello. Use it when you need to identify or access the board associated with a particular list."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/lists/{id}/board".format(id=list_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": board_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_list_cards(
    context: ToolContext,
    list_id: Annotated[str, "The ID of the Trello list from which to retrieve cards."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-lists-id-cards'."]:
    """Retrieve all cards from a specific Trello list.

    Use this tool to get a list of all cards from a specific Trello list by providing the list ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/lists/{id}/cards".format(id=list_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_member_details(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member to be retrieved."
    ],
    include_actions_details: Annotated[
        str | None,
        "Include detailed actions information associated with the member. Refer to the Actions Nested Resource for more options.",  # noqa: E501
    ] = None,
    include_boards_details: Annotated[
        str | None,
        "Include details of boards associated with the member. See the Boards Nested Resource for additional options.",  # noqa: E501
    ] = None,
    board_background_options: Annotated[
        str | None,
        "Specifies which board backgrounds to retrieve. Options include: 'all', 'custom', 'default', 'none', 'premium'.",  # noqa: E501
    ] = None,
    boards_invited_filter: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list (closed, members, open, organization, pinned, public, starred, unpinned) to filter invited boards.",  # noqa: E501
    ] = None,
    boards_invited_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of board fields like id, name, desc, etc.",
    ] = None,
    include_card_details: Annotated[
        str | None,
        "Options to include card-related information about the member. See the Cards Nested Resource for additional options.",  # noqa: E501
    ] = None,
    include_custom_board_backgrounds: Annotated[
        str | None,
        "Specify `all` to include all custom board backgrounds or `none` to exclude them.",
    ] = None,
    include_custom_emoji: Annotated[
        str | None,
        "Set to 'all' to include all custom emoji details for the member, or 'none' to exclude them.",  # noqa: E501
    ] = None,
    include_custom_stickers: Annotated[
        str | None,
        "Specify 'all' to include all custom stickers or 'none' to exclude them when retrieving member details.",  # noqa: E501
    ] = None,
    member_detail_fields: Annotated[
        str | None, "Specify `all` or a comma-separated list of member fields to retrieve."
    ] = None,
    include_notifications: Annotated[
        str | None,
        "Specify whether to include notifications details for the Trello member. Follow the Notifications Nested Resource guidelines.",  # noqa: E501
    ] = None,
    organizations_inclusion: Annotated[
        str | None,
        "Specify if and which organizations related to the member should be returned. One of: `all`, `members`, `none`, `public`.",  # noqa: E501
    ] = None,
    organization_fields: Annotated[
        str | None, "Specify `all` or a comma-separated list of organization fields (`id`, `name`)."
    ] = None,
    invited_organizations_scope: Annotated[
        str | None,
        "Specify the scope of invited organizations to include in the response. Options: 'all', 'members', 'none', 'public'.",  # noqa: E501
    ] = None,
    organization_fields_invited: Annotated[
        str | None,
        "Comma-separated list of invited organization fields or 'all'. Options: 'id', 'name'.",
    ] = None,
    include_tokens: Annotated[
        str | None,
        'Specify if all tokens associated with the member should be returned. Use `"all"` to include tokens, or `"none"` to exclude them.',  # noqa: E501
    ] = None,
    include_board_stars: Annotated[
        bool | None, "Set to true to include board stars in the response."
    ] = None,
    include_paid_account_info_in_workspace: Annotated[
        bool | None, "Set to true to include paid account information in the workspace object."
    ] = None,
    include_paid_account_info: Annotated[
        bool | None,
        "Set to true to include paid account information in the Trello member response.",
    ] = None,
    include_saved_searches: Annotated[
        bool | None, "Set to true to include saved searches data in the response."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members=id'."]:
    """Retrieve details of a Trello member by ID.

    Use this tool to get comprehensive information about a specific Trello member by providing their ID. Its ideal for obtaining member profile data and understanding user-specific information in Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}".format(id=member_id_or_username),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "actions": include_actions_details,
            "boards": include_boards_details,
            "boardBackgrounds": board_background_options,
            "boardsInvited": boards_invited_filter,
            "boardsInvited_fields": boards_invited_fields,
            "boardStars": include_board_stars,
            "cards": include_card_details,
            "customBoardBackgrounds": include_custom_board_backgrounds,
            "customEmoji": include_custom_emoji,
            "customStickers": include_custom_stickers,
            "fields": member_detail_fields,
            "notifications": include_notifications,
            "organizations": organizations_inclusion,
            "organization_fields": organization_fields,
            "organization_paid_account": include_paid_account_info_in_workspace,
            "organizationsInvited": invited_organizations_scope,
            "organizationsInvited_fields": organization_fields_invited,
            "paid_account": include_paid_account_info,
            "savedSearches": include_saved_searches,
            "tokens": include_tokens,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_trello_member(
    context: ToolContext,
    member_identifier: Annotated[str, "The ID or username of the Trello member to update."],
    new_member_full_name: Annotated[
        str | None, "New name for the member. It should not begin or end with a space."
    ] = None,
    member_initials: Annotated[
        str | None, "New initials for the member, between 1 and 4 characters long."
    ] = None,
    new_username: Annotated[
        str | None,
        "New username for the member. Must be unique, at least 3 characters long, only lowercase letters, underscores, and numbers.",  # noqa: E501
    ] = None,
    member_bio: Annotated[
        str | None,
        "Biography or description for the member. Allows personalization or additional information about the member.",  # noqa: E501
    ] = None,
    avatar_source_option: Annotated[
        str | None, "Specify the source for the avatar. Options: 'gravatar', 'none', 'upload'."
    ] = None,
    preferred_locale: Annotated[
        str | None, "Specify the preferred language locale for the member."
    ] = None,
    update_interval_minutes: Annotated[
        int | None,
        "Set the interval for summaries in minutes. Use `-1` to disable, `1` for frequent, or `60` for hourly updates.",  # noqa: E501
    ] = None,
    enable_color_blind_mode: Annotated[
        bool | None,
        "Enable or disable color blind mode for the member. `true` to enable; `false` to disable.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-members-id'."]:
    """Update a member's information on Trello.

    Use this tool to update details of a Trello member by specifying their ID. This is useful for modifying user information or settings."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}".format(id=member_identifier),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "fullName": new_member_full_name,
            "initials": member_initials,
            "username": new_username,
            "bio": member_bio,
            "avatarSource": avatar_source_option,
            "prefs/colorBlind": enable_color_blind_mode,
            "prefs/locale": preferred_locale,
            "prefs/minutesBetweenSummaries": update_interval_minutes,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_member_property(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member whose property is to be fetched."
    ],
    member_property_field: Annotated[
        str, "Specify which field (e.g., id, username) of the Trello member to retrieve."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members-id-field'."]:
    """Fetch a specific property of a Trello member.

    Use this tool to retrieve a particular property of a member in Trello by specifying the member's ID and the desired field."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/{field}".format(  # noqa: UP032
            id=member_id_or_username, field=member_property_field
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_member_actions(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member whose actions are being retrieved."
    ],
    action_types_filter: Annotated[
        str | None,
        "A comma-separated list of action types to filter the actions performed by a member.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members-id-actions'."]:
    """Retrieve actions performed by a Trello member.

    Use this tool to obtain a list of actions associated with a specific Trello member.
    It is useful when you need to track or analyze the activities of a member on Trello."""
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/actions".format(id=member_id_or_username),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "filter": action_types_filter,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_custom_board_backgrounds(
    context: ToolContext,
    member_id_or_username: Annotated[
        str,
        "The ID or username of the Trello member whose custom board backgrounds you want to retrieve.",  # noqa: E501
    ],
    background_filter: Annotated[
        str | None,
        "Filter results to include specific types of board backgrounds: `all`, `custom`, `default`, `none`, or `premium`.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members-id-boardbackgrounds'."]:
    """Retrieve a member's custom board backgrounds on Trello.

    This tool fetches a member's custom board backgrounds from Trello. It should be called when you need to access the personalized board backgrounds created or used by a specific member."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/boardBackgrounds".format(  # noqa: UP032
            id=member_id_or_username
        ),
        method="GET",
        params=remove_none_values({
            "filter": background_filter,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def upload_board_background(
    context: ToolContext,
    background_file: Annotated[
        str,
        "The path to the file to be uploaded as the new board background. It should be a valid file path or URL.",  # noqa: E501
    ],
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member to upload the board background for."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'post-members-id-boardbackgrounds-1'."
]:
    """Upload a new background to a Trello board.

    Use this tool to upload a new background to a specific Trello board. It should be called when there's a need to update or add a board background under a member's account."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/boardBackgrounds".format(  # noqa: UP032
            id=member_id_or_username
        ),
        method="POST",
        params=remove_none_values({
            "file": background_file,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_member_board_background(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member for whom to retrieve the board background."
    ],
    board_background_id: Annotated[str, "The ID of the board background to retrieve details for."],
    background_fields: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of background details like `brightness`, `fullSizeUrl`, `scaled`, `tile`.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-members-id-boardbackgrounds-idbackground'."
]:
    """Retrieve a member's board background in Trello.

    Use this tool to retrieve the background details of a specific board associated with a member in Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/boardBackgrounds/{idBackground}".format(  # noqa: UP032
            id=member_id_or_username, idBackground=board_background_id
        ),
        method="GET",
        params=remove_none_values({
            "fields": background_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_board_background(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the member whose board background is being updated."
    ],
    board_background_id: Annotated[
        str, "The unique identifier for the board background to be updated."
    ],
    background_brightness: Annotated[
        str | None,
        "Set the brightness of the board background. Accepted values: 'dark', 'light', 'unknown'.",
    ] = None,
    tile_background: Annotated[
        bool | None, "Set to true if you want the board background to be tiled."
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-members-id-boardbackgrounds-idbackground'."
]:
    """Update a Trello board background for a member.

    Use this tool to update the background of a Trello board for a specified member. Ideal for personalizing or managing board appearances."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/boardBackgrounds/{idBackground}".format(  # noqa: UP032
            id=member_id_or_username, idBackground=board_background_id
        ),
        method="PUT",
        params=remove_none_values({
            "brightness": background_brightness,
            "tile": tile_background,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_board_background(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member whose board background you want to delete."
    ],
    board_background_id: Annotated[str, "The unique ID of the board background to be deleted."],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'delete-members-id-boardbackgrounds-idbackground'.",
]:
    """Deletes a board background for a Trello member.

    Use this tool to delete a specified board background for a Trello member. This should be called when a user needs to remove an unwanted or outdated background from their Trello board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/boardBackgrounds/{idBackground}".format(  # noqa: UP032
            id=member_id_or_username, idBackground=board_background_id
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_member_board_stars(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member whose board stars are to be listed."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members-id-boardstars'."]:
    """Retrieve a member's starred boards.

    Call this tool to list the boards that a specific member has starred in Trello."""
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/boardStars".format(id=member_id_or_username),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def star_board_for_member(
    context: ToolContext,
    board_id_to_star: Annotated[str, "The ID of the board that you want to star for the member."],
    position_of_starred_board: Annotated[
        str,
        "Specifies the position for the newly starred board: 'top', 'bottom', or a positive float for precise placement.",  # noqa: E501
    ],
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member for whom the board will be starred."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-members-id-boardstars'."]:
    """Star a board for a Trello member.

    Use this tool to star a specific Trello board on behalf of a member. This is useful for members who want to highlight or prioritize certain boards for easy access."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/boardStars".format(id=member_id_or_username),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "idBoard": board_id_to_star,
            "pos": position_of_starred_board,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_board_star(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member whose boardStar details you want to retrieve."
    ],
    board_star_id: Annotated[
        str, "The unique ID of the board star to retrieve details for a member."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-members-id-boardstars-idstar'."
]:
    """Retrieve details of a specific boardStar for a member.

    Use this tool to get information about a particular boardStar associated with a member. It is useful for retrieving specific boardStar details such as the board's favorite status for a member."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/boardStars/{idStar}".format(  # noqa: UP032
            id=member_id_or_username, idStar=board_star_id
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_starred_board_position(
    context: ToolContext,
    member_id_or_username: Annotated[
        str,
        "The ID or username of the Trello member whose starred board position is being updated.",
    ],
    board_star_id: Annotated[
        str,
        "The unique identifier for the board star. Used to specify which starred board's position to update.",  # noqa: E501
    ],
    new_position_for_starred_board: Annotated[
        str | None,
        "Specify the new position for the starred board. Use 'top', 'bottom', or a positive float for a custom position.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-members-id-boardstars-idstar'."
]:
    """Update the position of a starred board on Trello.

    Use this tool to change the ordering of a user's starred boards on Trello by updating their position."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/boardStars/{idStar}".format(  # noqa: UP032
            id=member_id_or_username, idStar=board_star_id
        ),
        method="PUT",
        params=remove_none_values({
            "pos": new_position_for_starred_board,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def unstar_trello_board(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member to unstar a board for."
    ],
    board_star_id: Annotated[str, "The unique identifier of the board star to be removed."],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-members-id-boardstars-idstar'."
]:
    """Unstar a Trello board for a user.

    This tool is used to remove a star from a specified Trello board for a specific user. Call this tool when a user wants to unmark a board as a favorite."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/boardStars/{idStar}".format(  # noqa: UP032
            id=member_id_or_username, idStar=board_star_id
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_user_boards(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member whose boards are to be retrieved."
    ],
    board_filter: Annotated[
        str | None,
        "Comma-separated list of board filters like 'closed', 'members', etc., or 'all'.",
    ] = None,
    board_fields: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of board fields to include (e.g., `id,name,desc`).",  # noqa: E501
    ] = None,
    include_lists_with_boards: Annotated[
        str | None,
        "Specify which lists to include with the boards. Choose from: `all`, `closed`, `none`, `open`.",  # noqa: E501
    ] = None,
    include_organization_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of organization fields to include (e.g., 'id,name').",  # noqa: E501
    ] = None,
    include_organization: Annotated[
        bool | None,
        "Indicates whether to include the Organization object with the Boards. Set to true to include.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members-id-boards'."]:
    """Lists the boards that a user is a member of.

    Use this tool to retrieve a list of boards associated with a specific user ID on Trello."""
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/boards".format(id=member_id_or_username),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "filter": board_filter,
            "fields": board_fields,
            "lists": include_lists_with_boards,
            "organization": include_organization,
            "organization_fields": include_organization_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_member_invited_boards(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member to retrieve invited boards for."
    ],
    included_board_fields: Annotated[
        str | None, "Specify 'all' or a list of board fields to retrieve, such as 'id,name,desc'."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members-id-boardsinvited'."]:
    """Retrieve the boards a Trello member has been invited to.

    Use this tool to get a list of Trello boards that a specific member has been invited to. Useful for tracking invitations and access permissions for members."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/boardsInvited".format(id=member_id_or_username),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": included_board_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_member_trello_cards(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member to retrieve cards for."
    ],
    filter_status: Annotated[
        str | None,
        "Specify the filter for the cards: all, closed, complete, incomplete, none, open, or visible.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members-id-cards'."]:
    """Retrieve the cards assigned to a Trello member.

    Use this tool to get a list of cards that a particular Trello member is assigned to, identified by their member ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/cards".format(id=member_id_or_username),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "filter": filter_status,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_member_custom_board_backgrounds(
    context: ToolContext,
    member_id_or_username: Annotated[
        str,
        "The ID or username of the Trello member whose custom board backgrounds you want to retrieve.",  # noqa: E501
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-members-id-customboardbackgrounds'."
]:
    """Retrieve a member's custom board backgrounds on Trello.

    Use this tool to obtain a specific member's custom board backgrounds from Trello. This can be useful when customizing or reviewing a Trello board's appearance based on a member's personal background collection."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/customBoardBackgrounds".format(  # noqa: UP032
            id=member_id_or_username
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def upload_custom_board_background(
    context: ToolContext,
    background_image_file: Annotated[
        str,
        "Path to the image file to be uploaded as a custom board background. Ensure the file format is compatible with Trello.",  # noqa: E501
    ],
    member_id_or_username: Annotated[
        str,
        "The ID or username of the Trello member to whom the custom board background will be uploaded.",  # noqa: E501
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'membersidcustomboardbackgrounds-1'."
]:
    """Upload a new custom board background for a Trello board.

    This tool uploads a custom background image to a Trello board. Use it when you want to add a personalized background to enhance a board's appearance."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/customBoardBackgrounds".format(  # noqa: UP032
            id=member_id_or_username
        ),
        method="POST",
        params=remove_none_values({
            "file": background_image_file,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_custom_board_background(
    context: ToolContext,
    member_id_or_username: Annotated[
        str,
        "The ID or username of the member to identify whose custom board background to retrieve.",
    ],
    custom_background_id: Annotated[str, "The ID of the custom board background to retrieve."],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'get-members-id-customboardbackgrounds-idbackground'.",
]:
    """Get a specific custom board background by ID.

    Retrieve details of a particular custom board background using the member and background ID."""
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/customBoardBackgrounds/{idBackground}".format(  # noqa: UP032
            id=member_id_or_username, idBackground=custom_background_id
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_custom_board_background(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the member whose board background will be updated."
    ],
    custom_background_id: Annotated[str, "The ID of the custom background to update."],
    background_brightness: Annotated[
        str | None,
        "Set the brightness of the custom board background. Options: 'dark', 'light', 'unknown'.",
    ] = None,
    tile_background: Annotated[
        bool | None, "Set to true to tile the board background, false for no tiling."
    ] = None,
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'put-members-id-customboardbackgrounds-idbackground'.",
]:
    """Update a specific custom board background for a member.

    This tool updates the custom background of a board for a specified member. Use it when you need to modify or change the background image or style of a board on Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/customBoardBackgrounds/{idBackground}".format(  # noqa: UP032
            id=member_id_or_username, idBackground=custom_background_id
        ),
        method="PUT",
        params=remove_none_values({
            "brightness": background_brightness,
            "tile": tile_background,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_custom_board_background(
    context: ToolContext,
    member_id_or_username: Annotated[
        str,
        "The ID or username of the Trello member whose custom board background is to be deleted.",
    ],
    background_id: Annotated[str, "The ID of the custom background to be deleted."],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'delete-members-id-customboardbackgrounds-idbackground'.",
]:
    """Delete a specific custom board background on Trello.

    Use this tool to delete a custom board background for a specific member in Trello. Call this when you need to remove a visually customized board background permanently."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/customBoardBackgrounds/{idBackground}".format(  # noqa: UP032
            id=member_id_or_username, idBackground=background_id
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_member_custom_emojis(
    context: ToolContext,
    member_identifier: Annotated[
        str, "The ID or username of the Trello member to retrieve custom emojis for."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members-id-customemoji'."]:
    """Retrieve a member's uploaded custom emojis from Trello.

    This tool fetches the custom emojis uploaded by a specified member on Trello. Use it when you need to access or display a member's personalized emoji collection."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/customEmoji".format(id=member_identifier),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_custom_emoji(
    context: ToolContext,
    emoji_file_path: Annotated[
        str, "Path to the image file for the custom emoji. Must be a supported image format."
    ],
    emoji_name: Annotated[str, "Name for the custom emoji, must be between 2 to 64 characters."],
    member_identifier: Annotated[
        str,
        "The ID or username of the Trello member for whom the emoji is being created. This identifies the target member.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-members-id-customemoji'."]:
    """Create a new custom emoji for a Trello member.

    This tool is used to create a new custom emoji for a specific Trello member. It should be called when a user wants to add a personalized emoji to their Trello account."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/customEmoji".format(id=member_identifier),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "file": emoji_file_path,
            "name": emoji_name,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_member_custom_emoji(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The unique ID or username of the Trello member to retrieve custom emoji details for."
    ],
    custom_emoji_id: Annotated[str, "The unique identifier of the custom emoji."],
    custom_emoji_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of 'name', 'url' to determine which emoji details to return.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'membersidcustomemojiidemoji'."]:
    """Retrieve a member's custom emoji.

    Call this tool to obtain details about a specific custom emoji associated with a Trello member."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/customEmoji/{idEmoji}".format(  # noqa: UP032
            id=member_id_or_username, idEmoji=custom_emoji_id
        ),
        method="GET",
        params=remove_none_values({
            "fields": custom_emoji_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_member_uploaded_stickers(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member to retrieve their uploaded stickers."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members-id-customstickers'."]:
    """Retrieve a member's uploaded custom stickers on Trello.

    Use this tool to access all custom stickers uploaded by a specific member on Trello by providing their ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/customStickers".format(id=member_id_or_username),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def upload_custom_sticker(
    context: ToolContext,
    sticker_file_path: Annotated[
        str,
        "The file path of the custom sticker to upload. It should be a valid path to the sticker image file on the server or local system.",  # noqa: E501
    ],
    member_id_or_username: Annotated[
        str,
        "The ID or username of the Trello member for whom the custom sticker is being uploaded. This identifies the target member's account.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-members-id-customstickers'."]:
    """Upload a new custom sticker for a Trello member.

    This tool uploads a new custom sticker to a Trello member's account. It should be called when a user wants to personalize their Trello experience with custom stickers."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/customStickers".format(id=member_id_or_username),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "file": sticker_file_path,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_member_custom_sticker(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member whose sticker is being retrieved."
    ],
    sticker_id: Annotated[
        str, "The ID of the uploaded custom sticker to retrieve for a Trello member."
    ],
    sticker_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of 'scaled', 'url' to get specific details about the sticker.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-members-id-customstickers-idsticker'."
]:
    """Retrieve a specific custom sticker for a Trello member.

    Use this tool to get information about a custom sticker associated with a specific Trello member by providing the member's ID and the sticker's ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/customStickers/{idSticker}".format(  # noqa: UP032
            id=member_id_or_username, idSticker=sticker_id
        ),
        method="GET",
        params=remove_none_values({
            "fields": sticker_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_member_custom_sticker(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member whose custom sticker will be deleted."
    ],
    sticker_id: Annotated[
        str, "The ID of the uploaded sticker to be deleted from the member's profile."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-members-id-customstickers-idsticker'."
]:
    """Remove a member's custom sticker.

    Use this tool to delete a specified custom sticker from a Trello member's profile."""
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/customStickers/{idSticker}".format(  # noqa: UP032
            id=member_id_or_username, idSticker=sticker_id
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_member_notifications(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member to get notifications for."
    ],
    notification_filter: Annotated[
        str | None,
        "Filters notifications by type. Accepts a comma-separated list of types like `addMemberToCard`, `commentCard`, etc.",  # noqa: E501
    ] = None,
    notification_read_status: Annotated[
        str | None, "Filter notifications by read status: `all`, `read`, or `unread`."
    ] = None,
    notification_fields: Annotated[
        str | None, "Specify `all` or a comma-separated list of notification fields to retrieve."
    ] = None,
    notification_limit: Annotated[
        int | None, "Specify the number of notifications to retrieve, up to a maximum of 1000."
    ] = None,
    notification_page: Annotated[
        int | None,
        "Specify the page number of notifications to retrieve, with a maximum value of 100.",
    ] = None,
    notification_id_before: Annotated[
        str | None, "A notification ID to fetch notifications received before this ID."
    ] = None,
    since_notification_id: Annotated[
        str | None, "The notification ID to start retrieving notifications from."
    ] = None,
    member_creator_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of member field names to include data about the creator of the notification.",  # noqa: E501
    ] = None,
    include_entities: Annotated[
        bool | None, "Set to 'true' to include entities in notifications; 'false' to exclude them."
    ] = None,
    show_display: Annotated[
        bool | None, "Set to true to display notifications, otherwise notifications are not shown."
    ] = None,
    include_member_creator: Annotated[
        bool | None, "Include the member who created the notification in the response when true."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members-id-notifications'."]:
    """Retrieve notifications for a specific Trello member.

    Use this tool to get notifications for a specific member on Trello by providing their member ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/notifications".format(id=member_id_or_username),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "entities": include_entities,
            "display": show_display,
            "filter": notification_filter,
            "read_filter": notification_read_status,
            "fields": notification_fields,
            "limit": notification_limit,
            "page": notification_page,
            "before": notification_id_before,
            "since": since_notification_id,
            "memberCreator": include_member_creator,
            "memberCreator_fields": member_creator_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_member_workspaces(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The unique ID or username of the Trello member whose workspaces are to be retrieved."
    ],
    workspace_filter: Annotated[
        str | None,
        "Filter workspaces by type: `all`, `members`, `none`, or `public`. `members` filters to private workspaces.",  # noqa: E501
    ] = None,
    organization_fields: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of organization fields such as `id` or `name`.",
    ] = None,
    include_paid_account_info: Annotated[
        bool | None,
        "Set to true to include paid account information in the returned workspace objects.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members-id-organizations'."]:
    """Retrieve a member's workspaces from Trello.

    Use this tool to obtain a list of workspaces (organizations) associated with a specific Trello member. It should be called when you need information about the workspaces a user is part of on Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/organizations".format(id=member_id_or_username),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "filter": workspace_filter,
            "fields": organization_fields,
            "paid_account": include_paid_account_info,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_invited_workspaces(
    context: ToolContext,
    member_identifier: Annotated[
        str, "The ID or username of the Trello member to fetch invited workspaces for."
    ],
    organization_fields_selection: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of organization fields (e.g., 'id,name').",
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-members-id-organizationsinvited'."
]:
    """Fetches workspaces a member has been invited to.

    Call this tool to obtain a list of workspaces or organizations a Trello member has been invited to. Useful for checking pending workspace invitations."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/organizationsInvited".format(  # noqa: UP032
            id=member_identifier
        ),
        method="GET",
        params=remove_none_values({
            "fields": organization_fields_selection,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_member_saved_searches(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member to retrieve saved searches for."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members-id-savedsearches'."]:
    """Retrieve saved searches for a specified member.

    Use this tool to obtain the list of saved searches associated with a specific Trello member. It should be called when you need to access saved search data for a given member by their ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/savedSearches".format(id=member_id_or_username),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_saved_search_trello(
    context: ToolContext,
    saved_search_name: Annotated[
        str,
        "The name for the saved search in Trello. This is how the search will be referred to in the interface.",  # noqa: E501
    ],
    search_query: Annotated[str, "The search query to be saved for a Trello member."],
    saved_search_position: Annotated[
        str,
        "Specifies where to position the saved search: 'top', 'bottom', or a positive float for a custom position.",  # noqa: E501
    ],
    member_identifier: Annotated[
        str, "The ID or username of the Trello member for whom the saved search is being created."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-members-id-savedsearches'."]:
    """Create a saved search in Trello for a member.

    This tool is used to create a new saved search for a specific Trello member. It should be called when a user wants to save a search query for future use in their Trello account."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/savedSearches".format(id=member_identifier),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "name": saved_search_name,
            "query": search_query,
            "pos": saved_search_position,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_saved_search_details(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member whose saved search is being accessed."
    ],
    saved_search_id: Annotated[str, "The ID of the saved search to retrieve details for."],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-members-id-savedsearches-idsearch'."
]:
    """Retrieve detailed information about a saved search on Trello.

    This tool is used to fetch detailed information for a specific saved search of a Trello member. It should be called when you need to retrieve the parameters or criteria of a saved search identified by its ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/savedSearches/{idSearch}".format(  # noqa: UP032
            id=member_id_or_username, idSearch=saved_search_id
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_saved_search(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member for whom the saved search will be updated."
    ],
    saved_search_id: Annotated[str, "The ID of the saved search to be updated in Trello."],
    new_saved_search_name: Annotated[
        str | None, "The updated name for the saved search in Trello."
    ] = None,
    new_search_query: Annotated[
        str | None, "The updated search query for the saved search."
    ] = None,
    new_search_position: Annotated[
        str | None,
        "Specifies the new position for the saved search: `top`, `bottom`, or a positive float for custom positioning.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-members-id-savedsearches-idsearch'."
]:
    """Update a saved search in Trello for a specific member.

    This tool updates an existing saved search for a Trello member. Use it when you need to change details of a saved search, like search terms or settings."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/savedSearches/{idSearch}".format(  # noqa: UP032
            id=member_id_or_username, idSearch=saved_search_id
        ),
        method="PUT",
        params=remove_none_values({
            "name": new_saved_search_name,
            "query": new_search_query,
            "pos": new_search_position,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_saved_search(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member whose saved search will be deleted."
    ],
    saved_search_id: Annotated[str, "The ID of the saved search to delete for a Trello member."],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-members-id-savedsearches-idsearch'."
]:
    """Permanently remove a saved search for a Trello member.

    Use this tool when you need to delete a specific saved search for a Trello member by their ID and the search ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/savedSearches/{idSearch}".format(  # noqa: UP032
            id=member_id_or_username, idSearch=saved_search_id
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_member_app_tokens(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member whose app tokens are to be retrieved."
    ],
    include_webhooks: Annotated[
        bool | None, "Set to true to include webhooks in the response."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-members-id-tokens'."]:
    """Retrieve a list of a member's application tokens.

    This tool retrieves a list of application tokens associated with a specific member. Use this when you need to access or manage a member's app tokens on Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/tokens".format(id=member_id_or_username),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "webhooks": include_webhooks,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_member_avatar(
    context: ToolContext,
    avatar_file_path: Annotated[
        str,
        "The file path of the image to be used as the new avatar for the member. The path must point to a valid image file.",  # noqa: E501
    ],
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member for whom the avatar is being created."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'membersidavatar'."]:
    """Create a new avatar for a Trello member.

    Use this tool to generate a new avatar for a specified Trello member by providing their ID."""
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/avatar".format(id=member_id_or_username),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "file": avatar_file_path,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def dismiss_trello_message(
    context: ToolContext,
    message_to_dismiss: Annotated[
        str, "The content of the Trello message to be dismissed for the member."
    ],
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member for whom the message will be dismissed."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'post-members-id-onetimemessagesdismissed'."
]:
    """Dismiss a specific message for a Trello member.

    Use this tool to dismiss a one-time message for a Trello member by their ID."""
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/oneTimeMessagesDismissed".format(  # noqa: UP032
            id=member_id_or_username
        ),
        method="POST",
        params=remove_none_values({
            "value": message_to_dismiss,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_member_notification_settings(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member to retrieve notification settings for."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-members-id-notificationChannelSettings'."
]:
    """Retrieve a member's notification channel settings on Trello.

    This tool is used to get the notification settings for a specific member in Trello. Useful for understanding how and through which channels a member receives notifications."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/notificationsChannelSettings".format(  # noqa: UP032
            id=member_id_or_username
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_blocked_notification_keys(
    context: ToolContext,
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member to fetch blocked notification keys."
    ],
    notification_channel: Annotated[
        str, "Specify the channel to block notifications on. Currently, 'email' is supported."
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'get-members-id-notificationChannelSettings-channel'.",
]:
    """Fetch blocked notification keys for a Trello member's channel.

    This tool retrieves the blocked notification keys of a specific Trello member on a designated channel. It is useful for managing or auditing notification settings for a user's communication channels."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/notificationsChannelSettings/{channel}".format(  # noqa: UP032
            id=member_id_or_username, channel=notification_channel
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_member_notification_blocked_keys(
    context: ToolContext,
    member_id_or_username: Annotated[
        str,
        "The ID or username of the Trello member whose notification settings you want to update.",
    ],
    notification_channel: Annotated[
        str, "Specifies the channel (e.g., 'email') on which to block notifications."
    ],
    blocked_notification_keys: Annotated[
        str,
        "Comma-separated list of notification keys to block for the member's channel. Valid keys include 'notification_comment_card', 'notification_added_a_due_date', etc.",  # noqa: E501
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'put-members-id-notificationChannelSettings-channel-blockedKeys'.",  # noqa: E501
]:
    """Update blocked notification keys for a member's channel.

    Use this tool to update the list of blocked notification keys for a specific channel of a Trello member. This is useful to customize notification preferences on a per-channel basis."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/members/{id}/notificationsChannelSettings/{channel}/{blockedKeys}".format(  # noqa: UP032
            id=member_id_or_username,
            channel=notification_channel,
            blockedKeys=blocked_notification_keys,
        ),
        method="PUT",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_notification(
    context: ToolContext,
    notification_id: Annotated[
        str, "The unique identifier for the specific Trello notification to retrieve."
    ],
    board_fields_to_include: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of board fields (e.g., `id,name,desc`) to retrieve.",  # noqa: E501
    ] = None,
    card_fields_to_include: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of card fields to include in the response. Valid options: id, address, badges, checkItemStates, closed, coordinates, creationMethod, dueComplete, dateLastActivity, desc, descData, due, dueReminder, idBoard, idChecklists, idLabels, idList, idMembers, idMembersVoted, idShort, idAttachmentCover, labels, limits, locationName, manualCoverAttachment, name, pos, shortLink, shortUrl, subscribed, url, cover, isTemplate.",  # noqa: E501
    ] = None,
    notification_fields: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of notification fields like `id`, `unread`, `type`, etc.",  # noqa: E501
    ] = None,
    member_fields_inclusion: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of member fields to include in the response.",
    ] = None,
    include_member_creator_fields: Annotated[
        str | None,
        "`all` or a comma-separated list of member fields to include for the member creator.",
    ] = None,
    organization_field_selection: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of organization fields like `id,name` to include in the result.",  # noqa: E501
    ] = None,
    include_board_object: Annotated[
        bool | None, "Set to true to include the board object in the notification details."
    ] = None,
    include_card: Annotated[
        bool | None, "Set to true to include the card object in the notification response."
    ] = None,
    include_display: Annotated[
        bool | None, "Set to true to include the display object in the results."
    ] = None,
    include_entities: Annotated[
        bool | None, "Set to true to include the entities object in the results."
    ] = None,
    include_list_object: Annotated[
        bool | None, "Include the list object in the notification details when true."
    ] = None,
    include_member: Annotated[
        bool | None, "Include the member object in the response when true; exclude it when false."
    ] = None,
    include_member_creator_object: Annotated[
        bool | None,
        "Set to true to include the member object of the creator in the notification details.",
    ] = None,
    include_organization: Annotated[
        bool | None, "Set to true to include the organization object in the notification details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-notifications-id'."]:
    """Retrieve a specific Trello notification by its ID.

    Use this tool to get the details of a specific notification on Trello by providing the notification ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/notifications/{id}".format(id=notification_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "board": include_board_object,
            "board_fields": board_fields_to_include,
            "card": include_card,
            "card_fields": card_fields_to_include,
            "display": include_display,
            "entities": include_entities,
            "fields": notification_fields,
            "list": include_list_object,
            "member": include_member,
            "member_fields": member_fields_inclusion,
            "memberCreator": include_member_creator_object,
            "memberCreator_fields": include_member_creator_fields,
            "organization": include_organization,
            "organization_fields": organization_field_selection,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_notification_status(
    context: ToolContext,
    notification_id: Annotated[
        str, "The unique identifier of the Trello notification to be updated."
    ],
    mark_as_read: Annotated[
        bool | None, "Set to true to mark the notification as read, false to keep it unread."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-notifications-id'."]:
    """Update the read status of a Trello notification.

    This tool updates the read status of a specific Trello notification. It should be called when you want to mark a notification as read or unread in Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/notifications/{id}".format(id=notification_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "unread": mark_as_read,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_notification_property(
    context: ToolContext,
    notification_id: Annotated[
        str, "The unique ID of the notification to access its specific property."
    ],
    notification_property_field: Annotated[
        str, "The specific field of the notification to retrieve, such as 'id', 'type', or 'date'."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-notifications-id-field'."]:
    """Retrieve a specific property from a Trello notification.

    Use this tool to obtain a particular attribute of a Trello notification by specifying the notification ID and the desired field. Useful when needing detailed information about a notification."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/notifications/{id}/{field}".format(  # noqa: UP032
            id=notification_id, field=notification_property_field
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def mark_all_notifications_read(
    context: ToolContext,
    notification_ids_to_mark: Annotated[
        list[str] | None,
        "A list of notification IDs to mark as read or unread. Useful for managing specific notifications.",  # noqa: E501
    ] = None,
    mark_notifications_read: Annotated[
        bool | None,
        "Boolean to specify whether to mark notifications as read (true) or unread (false). Defaults to true (mark as read).",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-notifications-all-read'."]:
    """Mark all Trello notifications as read.

    Use this tool to mark all notifications in Trello as read, helping users manage their notification inbox efficiently."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/notifications/all/read",
        method="POST",
        params=remove_none_values({
            "read": mark_notifications_read,
            "ids": notification_ids_to_mark,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_notification_read_status(
    context: ToolContext,
    notification_id: Annotated[
        str, "The unique identifier of the Trello notification to update the read status for."
    ],
    notification_unread_status: Annotated[
        str | None, "Specify 'true' to mark the notification as unread, 'false' to mark it as read."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-notifications-id-unread'."]:
    """Update the read status of a Trello notification.

    This tool updates the read status of a specific Trello notification by marking it as read or unread."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/notifications/{id}/unread".format(id=notification_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "value": notification_unread_status,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_board_notification_info(
    context: ToolContext,
    notification_id: Annotated[
        str, "The unique ID of the notification to retrieve the associated board."
    ],
    board_fields_selection: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of board fields like id, name, desc, etc., to retrieve specific board details.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-notifications-id-board'."]:
    """Retrieve the board associated with a specific notification.

    Use this tool to find out which Trello board a particular notification is linked to. It is useful when needing to trace the context or origin of notifications within Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/notifications/{id}/board".format(id=notification_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": board_fields_selection,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_notification_card(
    context: ToolContext,
    notification_id: Annotated[
        str, "The unique ID of the notification to retrieve the associated card."
    ],
    card_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of card fields to retrieve. Choose from 'id', 'address', 'badges', etc.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-notifications-id-card'."]:
    """Retrieve the card linked to a specific notification.

    This tool fetches the card details associated with a given notification ID on Trello. It should be used when you need information about the card referenced in a notification."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/notifications/{id}/card".format(id=notification_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": card_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_notification_list(
    context: ToolContext,
    notification_id: Annotated[
        str, "The unique ID of the Trello notification to retrieve the associated list."
    ],
    list_fields: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of list fields to retrieve for the notification.",
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-notifications-id-list'."]:
    """Retrieve the list linked to a specific Trello notification.

    Use this tool to get the list information associated with a given Trello notification ID. This is useful for identifying which list is involved in a notification or for further actions related to that list."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/notifications/{id}/list".format(id=notification_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": list_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_notification_member(
    context: ToolContext,
    notification_id: Annotated[
        str, "The unique ID of the Trello notification to retrieve the member information for."
    ],
    member_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of member fields to retrieve details about the member a notification is about.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'notificationsidmember'."]:
    """Get the member a notification is about.

    Fetches information about the member involved in a specific Trello notification, excluding the creator."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/notifications/{id}/member".format(id=notification_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": member_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_notification_creator(
    context: ToolContext,
    notification_id: Annotated[
        str, "The unique identifier for the notification whose creator details are to be retrieved."
    ],
    member_fields: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of member fields to retrieve information about the notification creator.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-notifications-id-membercreator'."
]:
    """Get the member who created the notification.

    Use this tool to fetch information about the member who created a specific notification in Trello. Ideal for understanding the origin of notifications."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/notifications/{id}/memberCreator".format(id=notification_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": member_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_notification_organization(
    context: ToolContext,
    notification_id: Annotated[
        str, "The ID of the Trello notification to retrieve its associated organization."
    ],
    organization_fields: Annotated[
        str | None,
        "A string specifying 'all' or a comma-separated list of fields like 'id' or 'name' to retrieve about the organization.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-notifications-id-organization'."
]:
    """Retrieve the organization linked to a notification.

    Use this tool to obtain details about the organization associated with a specific Trello notification. It is useful when you need to understand the origin or context of a notification by identifying the related organization."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/notifications/{id}/organization".format(id=notification_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": organization_fields,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_trello_workspace(
    context: ToolContext,
    display_name_for_workspace: Annotated[
        str,
        "The name to display for the Trello workspace. This should be a descriptive and recognizable name.",  # noqa: E501
    ],
    workspace_description: Annotated[
        str | None,
        "A description for the Trello workspace. Provide details about the purpose or scope of this workspace.",  # noqa: E501
    ] = None,
    workspace_identifier: Annotated[
        str | None,
        "A unique string with at least 3 characters. Only lowercase letters, underscores, and numbers are allowed.",  # noqa: E501
    ] = None,
    workspace_website_url: Annotated[
        str | None, "The website URL for the workspace, must start with `http://` or `https://`."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-organizations'."]:
    """Create a new Trello workspace.

    Use this tool to create a new workspace in Trello. It should be called when you want to organize boards and manage team's projects under a new workspace."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations",
        method="POST",
        params=remove_none_values({
            "displayName": display_name_for_workspace,
            "desc": workspace_description,
            "name": workspace_identifier,
            "website": workspace_website_url,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_organization_details(
    context: ToolContext,
    organization_identifier: Annotated[
        str, "The ID or name of the Trello organization to fetch details for."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-organizations-id'."]:
    """Fetches details of a Trello organization by ID.

    Use this tool to obtain detailed information about a specific Trello organization using its ID. It provides the necessary details for managing or reviewing organization settings within Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}".format(id=organization_identifier),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_organization(
    context: ToolContext,
    organization_id_or_name: Annotated[str, "The ID or name of the Trello organization to update."],
    new_organization_name: Annotated[
        str | None,
        "A unique name for the organization with at least 3 lowercase letters, underscores, or numbers.",  # noqa: E501
    ] = None,
    new_display_name: Annotated[
        str | None,
        "A new display name for the organization. Must be at least 1 character long and not begin or end with a space.",  # noqa: E501
    ] = None,
    organization_description: Annotated[
        str | None, "A new description for the organization in Trello."
    ] = None,
    organization_website_url: Annotated[
        str | None, "A URL for the organization starting with 'http://', 'https://', or 'null'."
    ] = None,
    google_apps_domain: Annotated[
        str | None, "The Google Apps domain to link this organization to."
    ] = None,
    google_apps_version: Annotated[
        int | None,
        "Specifies the Google Apps version to link with the organization. It should be either `1` or `2`.",  # noqa: E501
    ] = None,
    workspace_board_visibility_restriction: Annotated[
        str | None,
        "Specifies who on the Workspace can make Workspace visible boards. Acceptable values: `admin`, `none`, `org`.",  # noqa: E501
    ] = None,
    private_board_visibility_restriction: Annotated[
        str | None,
        "Specifies who can create private boards within the organization. Acceptable values: `admin`, `none`, `org`.",  # noqa: E501
    ] = None,
    public_board_visibility_restriction: Annotated[
        str | None,
        "Specifies who in the workspace can create public boards. Options: 'admin', 'none', 'org'.",
    ] = None,
    organization_invite_restriction_email: Annotated[
        str | None,
        "An email address pattern with optional wildcard characters for restricting organization invites.",  # noqa: E501
    ] = None,
    workspace_visibility: Annotated[
        str | None, "Sets the visibility of the Workspace page. Options: `private` or `public`."
    ] = None,
    allow_external_members: Annotated[
        bool | None,
        "Set to false to prevent non-workspace members from being added to boards in the Workspace.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-organizations-id'."]:
    """Update the details of a Trello organization.

    This tool updates an organization's information in Trello using the organization's ID. Call this when changes to organization details are needed."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}".format(id=organization_id_or_name),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "name": new_organization_name,
            "displayName": new_display_name,
            "desc": organization_description,
            "website": organization_website_url,
            "prefs/associatedDomain": google_apps_domain,
            "prefs/externalMembersDisabled": allow_external_members,
            "prefs/googleAppsVersion": google_apps_version,
            "prefs/boardVisibilityRestrict/org": workspace_board_visibility_restriction,
            "prefs/boardVisibilityRestrict/private": private_board_visibility_restriction,
            "prefs/boardVisibilityRestrict/public": public_board_visibility_restriction,
            "prefs/orgInviteRestrict": organization_invite_restriction_email,
            "prefs/permissionLevel": workspace_visibility,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_organization(
    context: ToolContext,
    organization_id_or_name: Annotated[
        str, "The ID or name of the Trello organization to be deleted."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'delete-organizations-id'."]:
    """Delete an existing organization in Trello.

    Use this tool to permanently delete an organization from Trello by providing its ID."""
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}".format(id=organization_id_or_name),  # noqa: UP032
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_organization_field_trello(
    context: ToolContext,
    organization_id_or_name: Annotated[
        str, "The ID or name of the Trello organization to retrieve the field from."
    ],
    organization_field: Annotated[
        str, "The specific field of the organization to retrieve, such as 'id' or 'name'."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-organizations-id-field'."]:
    """Retrieve a specific field from a Trello organization.

    Use this tool to obtain specific details about a Trello organization by providing the organization ID and the field you are interested in."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/{field}".format(  # noqa: UP032
            id=organization_id_or_name, field=organization_field
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_workspace_actions(
    context: ToolContext,
    workspace_identifier: Annotated[
        str, "The unique ID or name of the Trello Workspace to retrieve actions for."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-organizations-id-actions'."]:
    """Retrieve actions from a specific Workspace.

    Use this tool to obtain a list of all actions taken within a specified Trello Workspace. This can help track changes, updates, and other activities."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/actions".format(id=workspace_identifier),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_workspace_boards(
    context: ToolContext,
    organization_identifier: Annotated[
        str, "The ID or name of the Trello organization (workspace) to list boards for."
    ],
    board_status_filter: Annotated[
        str | None,
        "Define which boards to list using `all` or a combination of `open`, `closed`, `members`, `organization`, `public`.",  # noqa: E501
    ] = None,
    board_fields_to_retrieve: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of board fields to retrieve (e.g., 'id,name,url').",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-organizations-id-boards'."]:
    """Retrieve boards in a specified Trello workspace.

    Use this tool to obtain a list of all boards within a specific Trello workspace, identified by its ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/boards".format(id=organization_identifier),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "filter": board_status_filter,
            "fields": board_fields_to_retrieve,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def start_organization_csv_export(
    context: ToolContext,
    workspace_identifier: Annotated[
        str, "The unique ID or name of the Trello Workspace to export."
    ],
    include_attachments: Annotated[
        bool | None, "Set to true to include attachments in the CSV export, false to exclude."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-organizations-id-exports'."]:
    """Initiate a CSV export for a Trello organization.

    Use this tool to trigger the export of a Trello organization's data into a CSV file. This is useful for archiving or analyzing organizational data outside of Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/exports".format(id=workspace_identifier),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "attachments": include_attachments,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def retrieve_trello_organization_exports(
    context: ToolContext,
    workspace_id_or_name: Annotated[
        str, "The ID or name of the Trello Workspace to retrieve exports for."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-organizations-id-exports'."]:
    """Retrieve exports for a Trello organization.

    This tool retrieves the exports available for a specified Trello organization using the organization's ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/exports".format(id=workspace_id_or_name),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_workspace_members(
    context: ToolContext,
    workspace_identifier: Annotated[
        str, "The ID or name of the Trello Workspace to retrieve members from."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-organizations-id-members'."]:
    """Retrieve members of a specified Trello Workspace.

    Use this tool to get a list of all members in a specified Trello Workspace by providing the Workspace ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/members".format(id=workspace_identifier),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_organization_members(
    context: ToolContext,
    member_email: Annotated[str, "The email address of the member to update in the organization."],
    member_full_name: Annotated[
        str, "Name for the member, must be at least 1 character and not begin or end with a space."
    ],
    organization_id_or_name: Annotated[str, "The ID or name of the Trello organization to update."],
    member_role_type: Annotated[
        str | None, "Specify the member's role: `admin` or `normal`."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-organizations-id-members'."]:
    """Update the members of a Trello organization.

    Use this tool to modify the membership of a specified Trello organization. It updates the organization members based on provided details."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/members".format(  # noqa: UP032
            id=organization_id_or_name
        ),
        method="PUT",
        params=remove_none_values({
            "email": member_email,
            "fullName": member_full_name,
            "type": member_role_type,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_workspace_memberships(
    context: ToolContext,
    organization_id_or_name: Annotated[
        str, "The ID or name of the Trello Workspace to list memberships for."
    ],
    membership_filter: Annotated[
        str | None,
        "Filter memberships by status: 'all', 'active', 'admin', 'deactivated', 'me', 'normal'. Use a comma-separated list for multiple.",  # noqa: E501
    ] = None,
    include_member_objects: Annotated[
        bool | None,
        "Set to true to include Member objects with the Memberships. Useful for detailed member info.",  # noqa: E501
    ] = None,
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-organizations-id-memberships'."
]:
    """Retrieve memberships of a specific Workspace on Trello.

    Use this tool to fetch a list of all memberships within a specified Trello Workspace. This can help identify members and their roles in the Workspace."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/memberships".format(  # noqa: UP032
            id=organization_id_or_name
        ),
        method="GET",
        params=remove_none_values({
            "filter": membership_filter,
            "member": include_member_objects,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_organization_membership(
    context: ToolContext,
    organization_id_or_name: Annotated[
        str, "The ID or name of the Trello organization to retrieve membership details."
    ],
    membership_id: Annotated[
        str,
        "The ID of the membership to retrieve within an organization. Use this to specify which membership details to load.",  # noqa: E501
    ],
    include_member_object: Annotated[
        bool | None, "Include the Member object in the response when true."
    ] = None,
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'get-organizations-id-memberships-idmembership'.",
]:
    """Retrieve details of a specific organization membership.

    Use this tool to get detailed information about a specific membership within an organization on Trello. It is particularly useful for understanding the membership attributes or status for a given organization and membership ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/memberships/{idMembership}".format(  # noqa: UP032
            id=organization_id_or_name, idMembership=membership_id
        ),
        method="GET",
        params=remove_none_values({
            "member": include_member_object,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_workspace_scoped_plugin_data(
    context: ToolContext,
    organization_id_or_name: Annotated[
        str, "The ID or name of the organization whose plugin data you want to retrieve."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-organizations-id-plugindata'."]:
    """Retrieve organization scoped pluginData for a Workspace.

    Call this tool to access plugin data that is specific to a particular Workspace in an organization. Ideal for retrieving information related to plugins configured within the Trello Workspace."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/pluginData".format(  # noqa: UP032
            id=organization_id_or_name
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def list_organization_collections(
    context: ToolContext,
    organization_identifier: Annotated[
        str, "The ID or name of the Trello organization whose collections are to be listed."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-organizations-id-tags'."]:
    """Retrieve collections of a specified organization.

    This tool fetches and lists the collections associated with a specific organization on Trello. It should be called when there is a need to access or display the organization's collections."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/tags".format(id=organization_identifier),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_organization_tag(
    context: ToolContext,
    organization_identifier: Annotated[
        str, "The ID or name of the organization for which the tag will be created."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-organizations-id-tags'."]:
    """Create a new tag within a specified organization on Trello.

    This tool is used to create a new tag for a specific organization in Trello. Call this tool when you need to organize tasks by adding a tag to an organization's board."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/tags".format(id=organization_identifier),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_workspace_member(
    context: ToolContext,
    member_role: Annotated[
        str, "Specify the member's role in the Workspace. Use 'admin' or 'normal'."
    ],
    workspace_organization_id_or_name: Annotated[
        str, "The ID or name of the Trello Workspace organization to update or add a member."
    ],
    member_id_or_username: Annotated[
        str, "The ID or username of the Trello member to update or add to the workspace."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'put-organizations-id-members-idmember'."
]:
    """Add or update a member in a Trello Workspace.

    This tool allows you to add a member to a Trello Workspace or update their role within the Workspace. Use it when you need to manage Workspace memberships."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/members/{idMember}".format(  # noqa: UP032
            id=workspace_organization_id_or_name, idMember=member_id_or_username
        ),
        method="PUT",
        params=remove_none_values({
            "type": member_role,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def remove_workspace_member(
    context: ToolContext,
    workspace_id_or_name: Annotated[
        str, "The ID or name of the Trello workspace from which the member will be removed."
    ],
    member_id_to_remove: Annotated[
        str, "The ID of the member to be removed from the Trello workspace."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'delete-organizations-id-members'."]:
    """Remove a member from a Trello workspace.

    This tool is used to remove a member from a specific Trello workspace. Call this tool when you need to manage workspace membership by removing a user."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/members/{idMember}".format(  # noqa: UP032
            id=workspace_id_or_name, idMember=member_id_to_remove
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def toggle_workspace_member_status(
    context: ToolContext,
    organization_identifier: Annotated[
        str, "The ID or name of the organization to identify the Workspace."
    ],
    member_id_or_username: Annotated[
        str,
        "The ID or username of the member whose status should be updated in the Trello Workspace.",
    ],
    deactivate_member: Annotated[
        bool, "A boolean value where true deactivates and false reactivates a member."
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'put-organizations-id-members-idmember-deactivated'.",
]:
    """Deactivate or reactivate a member of a Workspace on Trello.

    Use this tool to deactivate or reactivate a specified member within a Trello Workspace. It should be called when you need to change a member's active status."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/members/{idMember}/deactivated".format(  # noqa: UP032
            id=organization_identifier, idMember=member_id_or_username
        ),
        method="PUT",
        params=remove_none_values({
            "value": deactivate_member,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def set_workspace_logo(
    context: ToolContext,
    workspace_id_or_name: Annotated[
        str, "The ID or name of the Trello Workspace for which the logo will be set."
    ],
    workspace_logo_file: Annotated[
        str | None,
        "The path or binary data of the image file to set as the Workspace logo. It should be a valid image format.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-organizations-id-logo'."]:
    """Set the logo image for a Workspace on Trello.

    Use this tool to set or update the logo image for a specific Workspace in Trello by providing the Workspace ID and logo information."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/logo".format(id=workspace_id_or_name),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "file": workspace_logo_file,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_workspace_logo(
    context: ToolContext,
    workspace_identifier: Annotated[
        str, "The ID or name of the Trello workspace whose logo you want to delete."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'delete-organizations-id-logo'."]:
    """Deletes the logo from a Trello workspace.

    This tool deletes the logo from a specified Trello workspace by its ID. Use it when you need to remove a logo from a workspace to update its appearance."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/logo".format(id=workspace_identifier),  # noqa: UP032
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_member_from_workspace(
    context: ToolContext,
    organization_id_or_name: Annotated[
        str,
        "The ID or name of the Trello organization to specify which workspace the member should be removed from.",  # noqa: E501
    ],
    member_id_to_remove: Annotated[
        str, "The ID of the member to remove from the Trello Workspace and all associated boards."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'organizations-id-members-idmember-all'."
]:
    """Remove a member from a Trello Workspace and all its boards.

    This tool removes a specified member from a Trello Workspace and all associated boards. It should be used when you need to completely revoke a member's access to a workspace and its boards."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/members/{idMember}/all".format(  # noqa: UP032
            id=organization_id_or_name, idMember=member_id_to_remove
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def remove_workspace_google_domain(
    context: ToolContext,
    organization_id_or_name: Annotated[
        str,
        "The ID or name of the Trello organization (Workspace) to disassociate from the Google Apps domain.",  # noqa: E501
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'delete-organizations-id-prefs-associateddomain'.",
]:
    """Remove the associated Google Apps domain from a Workspace.

    This tool deletes the associated Google Apps domain from a specified Trello Workspace. It should be called when you need to disassociate a Google domain from a Workspace."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/prefs/associatedDomain".format(  # noqa: UP032
            id=organization_id_or_name
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def remove_workspace_invite_restriction(
    context: ToolContext,
    organization_id_or_name: Annotated[
        str, "The ID or name of the Trello organization to remove invite restrictions from."
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'delete-organizations-id-prefs-orginviterestrict'.",
]:
    """Removes email domain restrictions for Workspace invitations.

    Use this tool to remove any email domain restrictions on who can be invited to a Trello Workspace. It should be called when there's a need to allow broader invitations to the Workspace without domain limitations."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/prefs/orgInviteRestrict".format(  # noqa: UP032
            id=organization_id_or_name
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_organization_tag(
    context: ToolContext,
    organization_identifier: Annotated[
        str, "The ID or name of the organization from which to delete the tag."
    ],
    tag_id_to_delete: Annotated[
        str, "The identifier for the tag that needs to be deleted from the organization in Trello."
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-organizations-id-tags-idtag'."
]:
    """Delete a tag from an organization in Trello.

    Use this tool to remove a specific tag from an organization in Trello, identified by the organization ID and tag ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/tags/{idTag}".format(  # noqa: UP032
            id=organization_identifier, idTag=tag_id_to_delete
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def check_new_billable_guests_on_board(
    context: ToolContext,
    organization_id_or_name: Annotated[
        str,
        "The ID or name of the Trello organization to check for new billable guests on a board.",
    ],
    board_id_to_check_new_billable_guests: Annotated[
        str, "The ID of the Trello board to check for new billable guests."
    ],
) -> Annotated[
    dict[str, Any],
    "Response from the API endpoint 'get-organizations-id-newbillableguests-idboard'.",
]:
    """Checks for new billable guests on a specified Trello board.

    Use this tool to determine if a specific Trello board within an organization has acquired new billable guests."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/organizations/{id}/newBillableGuests/{idBoard}".format(  # noqa: UP032
            id=organization_id_or_name, idBoard=board_id_to_check_new_billable_guests
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_plugin(
    context: ToolContext,
    organization_id_or_name: Annotated[
        str, "The ID or name of the Trello organization to retrieve the plugin for."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-plugins-id'."]:
    """Retrieve details of a specific Trello plugin using its ID.

    Use this tool to fetch information about a specific Trello plugin by providing its ID. This is useful for obtaining plugin details directly from Trello."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/plugins/{id}/".format(id=organization_id_or_name),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_trello_plugin(
    context: ToolContext,
    organization_id_or_name: Annotated[
        str, "The ID or name of the Trello organization to update the plugin for."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-plugins-id'."]:
    """Update a Trello plugin by ID.

    Use this tool to modify the details of a specific Trello plugin by providing its ID. Ideal for updating plugin configurations or information."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/plugins/{id}/".format(id=organization_id_or_name),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_plugin_member_privacy_compliance(
    context: ToolContext,
    power_up_id: Annotated[
        str,
        "The unique identifier for the Power-Up to retrieve its member privacy compliance details.",
    ],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-plugins-id-compliance-memberprivacy'."
]:
    """Retrieve member privacy compliance for a specific plugin.

    This tool retrieves the member privacy compliance details for a specific plugin on Trello. Use this when you need to assess the privacy compliance status of a plugin regarding member information."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/plugins/{id}/compliance/memberPrivacy".format(id=power_up_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def trello_search(
    context: ToolContext,
    search_query: Annotated[
        str, "The search query string with a length between 1 and 16384 characters."
    ],
    board_filter: Annotated[
        str | None,
        "Specify `mine` or a comma-separated list of Board IDs to filter search results.",
    ] = None,
    organization_ids: Annotated[
        str | None, "A comma-separated list of Organization IDs to search within."
    ] = None,
    card_ids_list: Annotated[
        str | None, "A comma-separated list of Card IDs to search within specific cards."
    ] = None,
    search_object_types: Annotated[
        str | None,
        "Specify the Trello object types to search: `all` or a comma-separated list of `actions`, `boards`, `cards`, `members`, `organizations`.",  # noqa: E501
    ] = None,
    board_fields_to_include: Annotated[
        str | None,
        "Specify which board fields to include. Use 'all' or a comma-separated list like 'name,url'.",  # noqa: E501
    ] = None,
    maximum_boards_to_return: Annotated[
        int | None, "The maximum number of boards to return. Must be an integer from 1 to 1000."
    ] = None,
    card_fields_selection: Annotated[
        str | None,
        "Specify 'all' or a comma-separated list of card fields like 'name', 'due', 'labels' to include in the results.",  # noqa: E501
    ] = None,
    maximum_cards_to_return: Annotated[
        int | None, "The maximum number of cards to return, up to 1000."
    ] = None,
    cards_page_number: Annotated[
        float | None, "Specify the page number for card search results. Maximum value is 100."
    ] = None,
    include_card_attachments: Annotated[
        str | None,
        "Indicate whether to include attachment objects with card results. Accepts true, false, or 'cover' for only card cover attachments.",  # noqa: E501
    ] = None,
    organization_fields: Annotated[
        str | None,
        "Comma-separated list of organization fields to include. Options: all, billableMemberCount, desc, descData, displayName, idBoards, invitations, invited, logoHash, memberships, name, powerUps, prefs, premiumFeatures, products, url, website.",  # noqa: E501
    ] = None,
    maximum_workspaces_to_return: Annotated[
        int | None, "Specify the maximum number of Workspaces to return, up to a maximum of 1000."
    ] = None,
    member_fields: Annotated[
        str | None,
        "Specify member fields to retrieve. Options: all, or comma-separated list like `avatarHash`, `bio`, `fullName`, etc.",  # noqa: E501
    ] = None,
    maximum_members_to_return: Annotated[
        int | None,
        "Specify the maximum number of members to return. Must be an integer up to 1000.",
    ] = None,
    include_board_organization: Annotated[
        bool | None, "Include the parent organization with board results when set to true."
    ] = None,
    include_parent_board_with_card_results: Annotated[
        bool | None, "Include parent board information with card results. Use true to include."
    ] = None,
    include_parent_list_with_card_results: Annotated[
        bool | None, "Include the parent list with card results. True to include, false to exclude."
    ] = None,
    include_card_members: Annotated[
        bool | None, "True to include member objects with card results; false to exclude them."
    ] = None,
    include_card_stickers: Annotated[
        bool | None, "Set to true to include sticker objects with card results."
    ] = None,
    partial_match_search: Annotated[
        bool | None,
        "Search for content starting with any of the words in the query. Enables partial word matching within Trello.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-search'."]:
    """Search for anything in your Trello account.

    This tool allows users to perform a search in their Trello account to find boards, cards, and other items matching their query."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/search",
        method="GET",
        params=remove_none_values({
            "query": search_query,
            "idBoards": board_filter,
            "idOrganizations": organization_ids,
            "idCards": card_ids_list,
            "modelTypes": search_object_types,
            "board_fields": board_fields_to_include,
            "boards_limit": maximum_boards_to_return,
            "board_organization": include_board_organization,
            "card_fields": card_fields_selection,
            "cards_limit": maximum_cards_to_return,
            "cards_page": cards_page_number,
            "card_board": include_parent_board_with_card_results,
            "card_list": include_parent_list_with_card_results,
            "card_members": include_card_members,
            "card_stickers": include_card_stickers,
            "card_attachments": include_card_attachments,
            "organization_fields": organization_fields,
            "organizations_limit": maximum_workspaces_to_return,
            "member_fields": member_fields,
            "members_limit": maximum_members_to_return,
            "partial": partial_match_search,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def search_trello_members(
    context: ToolContext,
    search_query: Annotated[
        str, "The search query string, must be between 1 to 16384 characters in length."
    ],
    maximum_results: Annotated[
        int | None, "The maximum number of results to return, up to 20."
    ] = None,
    board_id: Annotated[
        str | None, "The ID of the board to search for members associated with it."
    ] = None,
    organization_id: Annotated[
        str | None, "The unique ID of the Trello organization to filter search results by."
    ] = None,
    search_only_organization_members: Annotated[
        bool | None, "Set to true to search only within organization members."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-search-members'."]:
    """Search for Trello members by criteria.

    Use this tool to search for Trello members based on specific criteria. Useful for finding users in an organization or project."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/search/members/",
        method="GET",
        params=remove_none_values({
            "query": search_query,
            "limit": maximum_results,
            "idBoard": board_id,
            "idOrganization": organization_id,
            "onlyOrgMembers": search_only_organization_members,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def retrieve_trello_token_info(
    context: ToolContext,
    trello_token: Annotated[
        str,
        "The Trello token string for which you want to retrieve information. This token identifies the authentication session.",  # noqa: E501
    ],
    token_info_fields: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of fields (`dateCreated`, `dateExpires`, `idMember`, `identifier`, `permissions`) to retrieve.",  # noqa: E501
    ] = None,
    include_webhooks: Annotated[
        bool | None, "Set to true to include webhooks in the token details."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-tokens-token'."]:
    """Retrieve information about a Trello token.

    Use this tool to get details about a specific Trello token, which may include access permissions and associated user or application information. Call this when you need to verify or inspect Trello token data."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/tokens/{token}".format(token=trello_token),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": token_info_fields,
            "webhooks": include_webhooks,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_token_owner_info(
    context: ToolContext,
    user_token: Annotated[
        str,
        "The Trello token provided by the user to authenticate and retrieve owner information. This should be a valid token string.",  # noqa: E501
    ],
    member_info_fields_to_retrieve: Annotated[
        str | None,
        "Specify `all` or a comma-separated list of fields to retrieve from the Member Object. Refer to the Trello documentation for valid fields.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-tokens-token-member'."]:
    """Retrieve information about a Trello token's owner.

    Call this tool to get details about the owner of a specific Trello token. Useful for verifying token ownership or accessing member-related data."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/tokens/{token}/member".format(token=user_token),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "fields": member_info_fields_to_retrieve,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_token_webhooks(
    context: ToolContext,
    trello_token: Annotated[
        str, "The Trello token to authenticate the request and fetch webhooks."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-tokens-token-webhooks'."]:
    """Retrieve webhooks created with a specific Trello token.

    Use this tool to obtain all webhooks that have been created using a specific Trello token. Useful for managing and reviewing webhook configurations."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/tokens/{token}/webhooks".format(token=trello_token),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def create_trello_webhook(
    context: ToolContext,
    webhook_post_url: Annotated[
        str, "The URL where the webhook will send POST requests when triggered."
    ],
    object_id_for_webhook: Annotated[
        str, "The ID of the Trello object (board or card) to create a webhook on."
    ],
    webhook_token: Annotated[
        str,
        "The Trello authorization token needed for creating the webhook. This grants access to the Trello account where the webhook will be set up.",  # noqa: E501
    ],
    webhook_description: Annotated[
        str | None,
        "A description displayed when retrieving webhook information. This should provide meaningful context for the Trello webhook.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-tokens-token-webhooks'."]:
    """Create a new webhook for a Trello token.

    Use this tool to create a new webhook associated with a specific Trello token. This is useful for setting up event notifications or integrations with Trello boards or cards."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/tokens/{token}/webhooks".format(token=webhook_token),  # noqa: UP032
        method="POST",
        params=remove_none_values({
            "description": webhook_description,
            "callbackURL": webhook_post_url,
            "idModel": object_id_for_webhook,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def retrieve_trello_webhook(
    context: ToolContext,
    access_token: Annotated[
        str, "The authentication token for accessing Trello's API to retrieve webhook details."
    ],
    webhook_id: Annotated[str, "The ID of the Trello webhook to retrieve."],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'get-tokens-token-webhooks-idwebhook'."
]:
    """Retrieve details of a Trello webhook using a token and webhook ID.

    Use this tool to get information about a specific webhook created with a Trello token. It requires a token and the webhook ID to access the details."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/tokens/{token}/webhooks/{idWebhook}".format(  # noqa: UP032
            token=access_token, idWebhook=webhook_id
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_trello_webhook(
    context: ToolContext,
    authentication_token: Annotated[
        str,
        "The authentication token for the Trello account to authorize the deletion of the webhook.",
    ],
    webhook_id: Annotated[str, "The ID of the Trello webhook to delete."],
) -> Annotated[
    dict[str, Any], "Response from the API endpoint 'delete-tokens-token-webhooks-idwebhook'."
]:
    """Delete a specific Trello webhook.

    Use this tool to delete a webhook in Trello, specified by token and webhook ID."""
    response = await make_request(
        url="https://api.trello.com/1/tokens/{token}/webhooks/{idWebhook}".format(  # noqa: UP032
            token=authentication_token, idWebhook=webhook_id
        ),
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_webhook_token(
    context: ToolContext,
    authentication_token: Annotated[
        str, "The token used for authentication to update the Trello webhook."
    ],
    webhook_id: Annotated[str, "ID of the Trello webhook to be updated."],
    webhook_description: Annotated[
        str | None, "Provide a description to display when retrieving webhook information."
    ] = None,
    callback_url: Annotated[str | None, "The URL to which the webhook will POST data."] = None,
    webhook_object_id: Annotated[
        str | None,
        "Provide the ID of the Trello object that the webhook is associated with. This ID is needed to identify which object the webhook should be updated for.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'tokenstokenwebhooks-1'."]:
    """Update a Trello webhook associated with a token.

    Use this tool to update the configuration of a Trello webhook linked with a specific token."""
    response = await make_request(
        url="https://api.trello.com/1/tokens/{token}/webhooks/{idWebhook}".format(  # noqa: UP032
            token=authentication_token, idWebhook=webhook_id
        ),
        method="PUT",
        params=remove_none_values({
            "description": webhook_description,
            "callbackURL": callback_url,
            "idModel": webhook_object_id,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def delete_trello_token(
    context: ToolContext,
    trello_token: Annotated[
        str, "The authentication token to be deleted. This is required for access removal."
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'delete-token'."]:
    """Delete a Trello API authentication token.

    Use this tool to delete a specific Trello API authentication token when it is no longer needed for access or should be invalidated for security reasons."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/tokens/{token}/".format(token=trello_token),  # noqa: UP032
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def add_trello_webhook(
    context: ToolContext,
    callback_url: Annotated[
        str,
        "A string for a valid URL that Trello can reach with `HEAD` and `POST` requests, used for receiving webhook payloads.",  # noqa: E501
    ],
    model_id_to_monitor: Annotated[
        str, "ID of the Trello model (e.g., board or card) to monitor for updates."
    ],
    webhook_description: Annotated[
        str | None,
        "Provide a description for the new webhook, with a length of 0 to 16384 characters.",
    ] = None,
    webhook_is_active: Annotated[
        bool | None,
        "Indicates if the webhook is active and sending POST requests. True to activate, false to deactivate.",  # noqa: E501
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'post-webhooks'."]:
    """Create a new webhook on Trello.

    This tool creates a new webhook in Trello, allowing users to receive updates about changes to boards or cards. Call this tool when you need to automate interactions or notifications based on Trello activities."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/webhooks/",
        method="POST",
        params=remove_none_values({
            "description": webhook_description,
            "callbackURL": callback_url,
            "idModel": model_id_to_monitor,
            "active": webhook_is_active,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_webhook_by_id(
    context: ToolContext,
    webhook_id: Annotated[str, "The unique identifier of the Trello webhook to retrieve."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'get-webhooks-id'."]:
    """Retrieve details of a Trello webhook by its ID.

    This tool fetches the details of a Trello webhook using its ID. Ensure to include the token used to create the webhook to avoid authorization errors."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/webhooks/{id}".format(id=webhook_id),  # noqa: UP032
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def update_trello_webhook(
    context: ToolContext,
    webhook_id: Annotated[str, "The unique ID of the Trello webhook to update."],
    webhook_description: Annotated[
        str | None,
        "Provide a description for the webhook, with a string length between 0 to 16384 characters.",  # noqa: E501
    ] = None,
    callback_url: Annotated[
        str | None, "A valid URL for the webhook to send POST and HEAD requests."
    ] = None,
    model_id_to_monitor: Annotated[
        str | None, "ID of the Trello model that the webhook will monitor."
    ] = None,
    set_webhook_active: Annotated[
        bool | None, "True to activate the webhook for sending POST requests; false to deactivate."
    ] = None,
) -> Annotated[dict[str, Any], "Response from the API endpoint 'put-webhooks-id'."]:
    """Update a Trello webhook by its ID.

    Use this tool to update the details of an existing Trello webhook by providing the webhook ID."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/webhooks/{id}".format(id=webhook_id),  # noqa: UP032
        method="PUT",
        params=remove_none_values({
            "description": webhook_description,
            "callbackURL": callback_url,
            "idModel": model_id_to_monitor,
            "active": set_webhook_active,
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def remove_trello_webhook(
    context: ToolContext,
    webhook_id: Annotated[str, "The unique ID of the Trello webhook to be deleted."],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'delete-webhooks-id'."]:
    """Deletes a Trello webhook using its ID.

    This tool is used to delete a specific Trello webhook by providing its unique ID. It should be called when there is a need to remove an existing webhook that is no longer required."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/webhooks/{id}".format(id=webhook_id),  # noqa: UP032
        method="DELETE",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}


@tool(requires_secrets=["TRELLO_API_KEY", "TRELLO_TOKEN"])
async def get_trello_webhook_field(
    context: ToolContext,
    webhook_id: Annotated[
        str, "The unique identifier of the Trello webhook to retrieve information from."
    ],
    webhook_field_to_retrieve: Annotated[
        str,
        "Specify the webhook field to retrieve. Options: `active`, `callbackURL`, `description`, `idModel`, `consecutiveFailures`, `firstConsecutiveFailDate`.",  # noqa: E501
    ],
) -> Annotated[dict[str, Any], "Response from the API endpoint 'webhooksidfield'."]:
    """Retrieve a specific field from a Trello webhook.

    Use this tool to access information about a specific field in a Trello webhook by providing the webhook ID and the desired field name."""  # noqa: E501
    response = await make_request(
        url="https://api.trello.com/1/webhooks/{id}/{field}".format(  # noqa: UP032
            id=webhook_id, field=webhook_field_to_retrieve
        ),
        method="GET",
        params=remove_none_values({
            "key": context.get_secret("TRELLO_API_KEY"),
            "token": context.get_secret("TRELLO_TOKEN"),
        }),
        headers=remove_none_values({}),
        data=remove_none_values({}),
    )
    try:
        return {"response_json": response.json()}
    except Exception:
        return {"response_text": response.text}
