twist_threads_star
Mark a thread as important in Twist workspaces by starring it for easy reference and prioritization.
Instructions
Stars a thread.
Args: id: The id of the thread
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/threads.py:183-203 (handler)The main handler function that implements the 'twist_threads_star' tool. It takes a thread ID, extracts parameters, retrieves the Twist API token from context, and makes a POST request to the Twist API endpoint 'threads/star' to star the thread.def twist_threads_star( ctx: Context, id: int ) -> str: """Stars a thread. Args: id: The id of the thread """ 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"Starring thread with ID: {id}") twist_request("threads/star", params=params, token=token, method="POST") logger.info(f"Successfully starred thread with ID: {id}") return f"Successfully starred thread with ID: {id}" except Exception as error: logger.error(f"Error starring thread: {error}") return f"Error starring thread: {str(error)}"
- main.py:42-48 (registration)Dynamic registration code that discovers and registers all functions starting with 'twist_' from the src.threads module (among others) as MCP tools using the 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)