Skip to main content
Glama
mikemc
by mikemc

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
NameRequiredDescriptionDefault
idYes
obj_indexYes

Implementation Reference

  • 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)

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mikemc/twist-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server