Skip to main content
Glama
mikemc
by mikemc

twist_threads_mark_all_read

Mark all threads as read in a Twist workspace or specific channel to clear your notification count and organize your inbox.

Instructions

Marks all threads in the workspace or channel as read.

Args: workspace_id: The id of the workspace channel_id: The id of the channel

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspace_idNo
channel_idNo

Implementation Reference

  • Handler function that implements the tool logic: marks all threads in specified workspace or channel as read by calling the Twist API endpoint 'threads/mark_all_read'.
    def twist_threads_mark_all_read(
        ctx: Context,
        workspace_id: Optional[int] = None,
        channel_id: Optional[int] = None
    ) -> str:
        """Marks all threads in the workspace or channel as read.
    
        Args:
            workspace_id: The id of the workspace
            channel_id: The id of the channel
        """
        all_params = locals()
        token = ctx.request_context.lifespan_context.twist_token
        params = {k: v for k, v in all_params.items() if k != 'ctx' and v is not None}
    
        if not workspace_id and not channel_id:
            workspace_id = os.getenv("TWIST_WORKSPACE_ID")
            if not workspace_id:
                logger.error("Either workspace_id or channel_id is required")
                return "Error: Either workspace_id or channel_id is required"
            params["workspace_id"] = workspace_id
    
        try:
            if "channel_id" in params:
                logger.info(f"Marking all threads in channel ID: {params['channel_id']} as read")
            else:
                logger.info(f"Marking all threads in workspace ID: {params['workspace_id']} as read")
    
            twist_request("threads/mark_all_read", params=params, token=token, method="POST")
    
            if "channel_id" in params:
                logger.info(f"Successfully marked all threads in channel ID: {params['channel_id']} as read")
                return f"Successfully marked all threads in channel ID: {params['channel_id']} as read"
            else:
                logger.info(f"Successfully marked all threads in workspace ID: {params['workspace_id']} as read")
                return f"Successfully marked all threads in workspace ID: {params['workspace_id']} as read"
        except Exception as error:
            logger.error(f"Error marking all threads as read: {error}")
            return f"Error marking all threads as read: {str(error)}"

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mikemc/twist-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server