twist_threads_mark_read
Mark Twist threads as read to manage your inbox by specifying thread ID and last read message index.
Instructions
Marks the thread as being read.
Args: id: The id of the thread obj_index: The index of the last known read message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ||
| obj_index | Yes |
Implementation Reference
- src/threads.py:323-345 (handler)The handler function that implements the tool logic: marks a specific thread as read up to a given comment index by calling the Twist API.def twist_threads_mark_read( ctx: Context, id: int, obj_index: int ) -> str: """Marks the thread as being read. Args: id: The id of the thread obj_index: The index of the last known read message """ 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 read up to comment index: {obj_index}") twist_request("threads/mark_read", params=params, token=token, method="POST") logger.info(f"Successfully marked thread with ID: {id} as read") return f"Successfully marked thread with ID: {id} as read up to comment index: {obj_index}" except Exception as error: logger.error(f"Error marking thread as read: {error}") return f"Error marking thread as read: {str(error)}"
- main.py:43-47 (registration)Dynamic registration loop that registers all functions starting with 'twist_' from src.threads (including twist_threads_mark_read) as MCP tools using mcp.tool().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)