twist_threads_clear_unread
Clear unread threads in your Twist workspace to manage your inbox and reduce notification clutter.
Instructions
Clears unread threads in workspace.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "twist_threads_clear_unread"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/threads.py:435-456 (handler)The main handler function that implements the tool logic by making a POST request to the Twist API endpoint 'threads/clear_unread' to clear unread threads in the specified workspace.
def twist_threads_clear_unread( ctx: Context ) -> str: """Clears unread threads in workspace. """ token = ctx.request_context.lifespan_context.twist_token workspace_id = os.getenv("TWIST_WORKSPACE_ID") if not workspace_id: logger.error("TWIST_WORKSPACE_ID environment variable is required") return "Error: TWIST_WORKSPACE_ID environment variable is required" params = {"workspace_id": workspace_id} try: logger.info(f"Clearing unread threads for workspace ID: {workspace_id}") twist_request("threads/clear_unread", params=params, token=token, method="POST") logger.info("Successfully cleared unread threads") return "Successfully cleared unread threads" except Exception as error: logger.error(f"Error clearing unread threads: {error}") return f"Error clearing unread threads: {str(error)}" - main.py:43-47 (registration)Dynamic registration loop that registers all functions starting with 'twist_' from src.inbox and src.threads modules as MCP tools, including twist_threads_clear_unread.
for module in [src.inbox, src.threads]: for name, func in inspect.getmembers(module, inspect.isfunction): if name.startswith('twist_') and func.__module__ == module.__name__: logger.info(f"Registering tool: {name}") mcp.tool()(func)