Skip to main content
Glama
mikemc
by mikemc

twist_threads_getone

Retrieve a specific thread from Twist workspaces by providing its unique ID to access conversation details and manage communication.

Instructions

Gets a thread object by id.

Args: id: The id of the thread

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • The main handler function for the 'twist_threads_getone' tool. It takes a context and thread ID, constructs parameters, and makes a request to the Twist API endpoint 'threads/getone' via twist_request to retrieve the thread data.
    def twist_threads_getone(
        ctx: Context,
        id: int
    ) -> Union[str, Dict[str, Any]]:
        """Gets a thread object by id.
    
        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"Getting thread with ID: {id}")
            thread_data = twist_request("threads/getone", params=params, token=token)
            logger.info(f"Retrieved thread with ID: {id}")
            return thread_data
        except Exception as error:
            logger.error(f"Error getting thread: {error}")
            return f"Error getting thread: {str(error)}"
  • The helper function used by the handler to make HTTP requests to the Twist API. It is called with endpoint='threads/getone' in the handler.
    def twist_request(endpoint, params=None, token=None, method="GET"):
        """
        Make an API request to Twist.
    
        Args:
            endpoint (str): API endpoint to call (without the base URL)
            params (dict, optional): Dictionary of parameters to include in the request
            token (str, optional): Authentication token (if None, uses the one from get_api_client)
            method (str, optional): HTTP method to use (default: "GET")
    
        Returns:
            dict: Response data as a dictionary
    
        Raises:
            Exception: If the API request fails
        """
        if token is None:
            token = get_api_client()
    
        base_url = "https://api.twist.com/api/v3/"
        headers = {"Authorization": f"Bearer {token}"}
        url = f"{base_url}{endpoint}"
    
        try:
            if method == "GET":
                response = requests.get(url, params=params, headers=headers)
            elif method == "POST":
                response = requests.post(url, data=params, headers=headers)
            else:
                raise ValueError(f"Unsupported HTTP method: {method}")
    
            response.raise_for_status()  # Raise an exception for 4XX/5XX responses
            return response.json()
        except requests.exceptions.RequestException as e:
            logger.error(f"Twist API request failed: {e}")
            raise
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'gets' a thread object, implying a read-only operation, but doesn't cover aspects like authentication requirements, error handling (e.g., for invalid IDs), rate limits, or what the return object includes. This leaves significant gaps for a tool with no annotation support.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, with the core purpose stated first ('Gets a thread object by id.') followed by parameter details. There's minimal waste, though the 'Args:' section could be integrated more seamlessly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity (one parameter) but lack of annotations and output schema, the description is incomplete. It doesn't explain what a 'thread object' contains, how errors are handled, or any behavioral traits, making it inadequate for safe and effective use by an AI agent without additional context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaningful context for the single parameter 'id' by specifying it as 'The id of the thread,' which clarifies its purpose beyond the schema's basic type (integer). With 0% schema description coverage and only one parameter, this compensation is effective, though it doesn't detail format constraints (e.g., valid ID ranges).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as 'Gets a thread object by id,' which is a specific verb (gets) and resource (thread object). It distinguishes from siblings like twist_threads_get (likely lists threads) and twist_threads_get_unread (filters by unread status), but doesn't explicitly mention these distinctions in the description text itself.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention siblings like twist_threads_get (for listing threads) or twist_threads_get_unread (for unread threads), nor does it specify prerequisites or contexts for retrieval by ID.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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