Skip to main content
Glama
mikemc
by mikemc

twist_threads_get_unread

Retrieve unread threads from your Twist workspace to manage your inbox and stay updated on conversations.

Instructions

Gets unread threads in a workspace for the authenticated user.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function that retrieves unread threads for the current workspace using the Twist API. It fetches the workspace ID from environment, makes the API call via twist_request, handles errors, and returns the list of unread threads or error message.
    def twist_threads_get_unread(
        ctx: Context
    ) -> Union[str, List[Dict[str, Any]]]:
        """Gets unread threads in a workspace for the authenticated user.
        """
        token = ctx.request_context.lifespan_context.twist_token
    
        workspace_id = os.getenv("TWIST_WORKSPACE_ID")
        if not workspace_id:
            logger.error("TWIST_WORKSPACE_ID environment variable is required")
            return "Error: TWIST_WORKSPACE_ID environment variable is required"
    
        params = {"workspace_id": workspace_id}
    
        try:
            logger.info(f"Getting unread threads for workspace ID: {workspace_id}")
            unread_data = twist_request("threads/get_unread", params=params, token=token)
    
            if not unread_data:
                logger.info("No unread threads found")
                return "No unread threads found"
    
            logger.info(f"Retrieved {len(unread_data)} unread threads")
            return unread_data
        except Exception as error:
            logger.error(f"Error getting unread threads: {error}")
            return f"Error getting unread threads: {str(error)}"
  • main.py:42-47 (registration)
    Dynamic registration of all functions starting with 'twist_' from src.inbox and src.threads modules as MCP tools using FastMCP. This includes the twist_threads_get_unread handler.
    # 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)
Behavior2/5

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

No annotations are provided, so the description carries full burden. It states it's a read operation ('Gets'), implying it's non-destructive, but doesn't disclose behavioral traits like authentication requirements, rate limits, pagination, error handling, or what 'unread' means contextually. For a tool with zero annotation coverage, this leaves significant gaps.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, with every part contributing essential information.

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

Completeness3/5

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

Given the tool has 0 parameters, 100% schema coverage, and no output schema, the description is minimally adequate. It explains what the tool does but lacks details on behavior, usage context, and output format. For a read operation with no annotations, it should ideally provide more context about what 'unread threads' entails and how results are returned.

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 tool has 0 parameters, and schema description coverage is 100%. With no parameters to document, the description doesn't need to add parameter semantics. A baseline of 4 is appropriate as it's not required to compensate for any parameter gaps.

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 verb ('Gets') and resource ('unread threads'), specifying the scope ('in a workspace for the authenticated user'). It distinguishes from siblings like 'twist_threads_get' by focusing on unread threads, but doesn't explicitly contrast with other unread-related tools like 'twist_threads_clear_unread' or 'twist_inbox_get_count'.

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 when-not scenarios, prerequisites, or compare with siblings like 'twist_threads_get' (which might get all threads) or 'twist_inbox_get' (which might handle inbox-specific threads).

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