twist_threads_pin
Pin important threads in Twist workspaces to keep them accessible and organized for team collaboration.
Instructions
Pins a thread.
Args: id: The id of the thread
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/threads.py:227-247 (handler)The main handler function for the 'twist_threads_pin' tool. It takes a thread ID, constructs parameters, and makes a POST request to the Twist API endpoint 'threads/pin' using the twist_request helper to pin the thread. Handles success and error cases with logging and returns a status message.def twist_threads_pin( ctx: Context, id: int ) -> str: """Pins 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"Pinning thread with ID: {id}") twist_request("threads/pin", params=params, token=token, method="POST") logger.info(f"Successfully pinned thread with ID: {id}") return f"Successfully pinned thread with ID: {id}" except Exception as error: logger.error(f"Error pinning thread: {error}") return f"Error pinning thread: {str(error)}"