twist_inbox_archive_all
Archives all threads in a Twist workspace based on a specified timestamp, helping you manage and clean up your inbox efficiently.
Instructions
Archives all threads in a workspace.
Args: older_than_ts: Only archives threads that are the same or older than this timestamp
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| older_than_ts | No |
Implementation Reference
- src/inbox.py:68-98 (handler)The core handler function for the 'twist_inbox_archive_all' tool. It retrieves the Twist token and workspace ID from context and environment, constructs parameters, and makes a POST request to the Twist API endpoint 'inbox/archive_all' to archive all inbox threads, optionally filtering by 'older_than_ts'. Returns success or error message.def twist_inbox_archive_all( ctx: Context, older_than_ts: Optional[int] = None ) -> str: """Archives all threads in a workspace. Args: older_than_ts: Only archives threads that are the same or older than this timestamp """ 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} if older_than_ts is not None: params["older_than_ts"] = older_than_ts try: logger.info(f"Archiving all inbox threads for workspace ID: {workspace_id}") result = twist_request("inbox/archive_all", params=params, token=token, method="POST") logger.info("Successfully archived all inbox threads") return "Successfully archived all inbox threads" except Exception as error: logger.error(f"Error archiving all inbox threads: {error}") return f"Error archiving all inbox threads: {str(error)}"
- main.py:42-48 (registration)Dynamic registration block that imports src.inbox (and src.threads), discovers all functions starting with 'twist_', and registers them as MCP tools using FastMCP's @tool decorator. This registers twist_inbox_archive_all among others.# Register all tools from tool modules 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)