Skip to main content
Glama
mikemc
by mikemc

twist_threads_move_to_channel

Move a thread from one channel to another in Twist workspaces to reorganize discussions and maintain organized communication channels.

Instructions

Moves the thread to a different channel.

Args: id: The id of the thread to_channel: The target channel's id

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
to_channelYes

Implementation Reference

  • The handler function that executes the logic to move a Twist thread to a different channel by calling the Twist API endpoint 'threads/move_to_channel'.
    def twist_threads_move_to_channel(
        ctx: Context,
        id: int,
        to_channel: int
    ) -> str:
        """Moves the thread to a different channel.
    
        Args:
            id: The id of the thread
            to_channel: The target channel's id
        """
        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"Moving thread with ID: {id} to channel: {to_channel}")
            twist_request("threads/move_to_channel", params=params, token=token, method="POST")
            logger.info(f"Successfully moved thread with ID: {id} to channel: {to_channel}")
            return f"Successfully moved thread with ID: {id} to channel: {to_channel}"
        except Exception as error:
            logger.error(f"Error moving thread: {error}")
            return f"Error moving thread: {str(error)}"
  • main.py:42-48 (registration)
    Dynamic registration loop that registers all functions starting with 'twist_' from src.threads (including twist_threads_move_to_channel) as MCP tools using FastMCP.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