Skip to main content
Glama

unfinished_threads

Identify and revisit important conversations with unresolved questions to continue exploration and decision-making processes.

Instructions

    Find conversations worth revisiting: exploring/crystallizing stage with open questions.
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
domainNo
importanceNosignificant

Implementation Reference

  • The 'unfinished_threads' tool handler finds conversations with open questions and certain thinking stages (exploring/crystallizing) that are marked as significant or breakthroughs. It queries a summaries database and formats the output into a markdown string.
    def unfinished_threads(domain: str = None, importance: str = "significant") -> str:
        """
        Find conversations worth revisiting: exploring/crystallizing stage with open questions.
        """
        sdb = get_summaries_db()
        if not sdb:
            return "Summary database not found."
    
        importance_filter = {
            "breakthrough": "importance = 'breakthrough'",
            "significant": "importance IN ('breakthrough', 'significant')",
            "routine": "1=1",
        }.get(importance, "importance IN ('breakthrough', 'significant')")
    
        where_parts = [
            "thinking_stage IN ('exploring', 'crystallizing')",
            importance_filter,
            "open_questions IS NOT NULL",
            "open_questions != '[]'",
            "open_questions NOT LIKE '%none identified%'",
        ]
        params = []
        if domain:
            where_parts.append("domain_primary = ?")
            params.append(domain)
    
        where_clause = " AND ".join(where_parts)
    
        results = sdb.execute(f"""
            SELECT conversation_id, title, source, domain_primary,
                   thinking_stage, importance, open_questions, summary, msg_count
            FROM summaries
            WHERE {where_clause}
            ORDER BY
                CASE importance WHEN 'breakthrough' THEN 0 WHEN 'significant' THEN 1 ELSE 2 END,
                msg_count DESC
            LIMIT 25
        """, params).fetchall()
    
        if not results:
            return f"No unfinished threads found{' in ' + domain if domain else ''}."
    
        filter_desc = f" in {domain}" if domain else ""
        output = [f"## Unfinished Threads{filter_desc} (importance >= {importance})\n"]
    
        for conv_id, title, source, dom, stage, imp, oq_raw, summary, msg_count in results:
            questions = parse_json_field(oq_raw)
            real_questions = [q for q in questions if q and "none identified" not in str(q).lower()]
            if not real_questions:
                continue
    
            imp_icon = {"breakthrough": "πŸ”₯", "significant": "⭐", "routine": "πŸ“"}.get(imp, "πŸ“")
            stage_icon = {"exploring": "πŸ”", "crystallizing": "πŸ’Ž"}.get(stage, "πŸ“")
    
            output.append(f"### {imp_icon} {stage_icon} {title or 'Untitled'}")
            output.append(f"_Domain: {dom} | Source: {source} | {msg_count} msgs_")
            output.append(f"> {(summary or '')[:200]}...")
            output.append("**Open questions**:")
            for q in real_questions[:3]:
                output.append(f"  ❓ {q[:200]}")
            if len(real_questions) > 3:
                output.append(f"  _... and {len(real_questions) - 3} more_")
            output.append(f"_ID: {conv_id[:20]}..._\n")
    
        return "\n".join(output)

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/mordechaipotash/brain-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server