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
| Name | Required | Description | Default |
|---|---|---|---|
| workspace_id | No | ||
| channel_id | No |
Implementation Reference
- src/threads.py:395-433 (handler)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)}"