twist_threads_mark_unread
Mark Twist threads as unread to track messages for later review or follow-up. Specify thread ID and message index to control unread status.
Instructions
Marks the thread as being unread.
Args: id: The id of the thread obj_index: The index of the last unread message. A value of -1 marks the whole thread as unread
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| obj_index | Yes |
Implementation Reference
- src/threads.py:347-369 (handler)The main handler function that executes the tool logic: extracts parameters, calls the Twist API 'threads/mark_unread' endpoint via twist_request, and returns success/error messages.def twist_threads_mark_unread( ctx: Context, id: int, obj_index: int ) -> str: """Marks the thread as being unread. Args: id: The id of the thread obj_index: The index of the last unread message. A value of -1 marks the whole thread as unread """ 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} try: logger.info(f"Marking thread with ID: {id} as unread from comment index: {obj_index}") twist_request("threads/mark_unread", params=params, token=token, method="POST") logger.info(f"Successfully marked thread with ID: {id} as unread") return f"Successfully marked thread with ID: {id} as unread from comment index: {obj_index}" except Exception as error: logger.error(f"Error marking thread as unread: {error}") return f"Error marking thread as unread: {str(error)}"
- main.py:42-48 (registration)Dynamically registers all functions starting with 'twist_' from src.threads (and inbox) modules as MCP tools using FastMCP's mcp.tool() decorator.# 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)