Skip to main content
Glama

what_was_i_thinking

Retrieve AI conversation snapshots from a specific month to review past thoughts and decision-making patterns.

Instructions

    Time-travel snapshot: What was on your mind during a specific month?
    Format: YYYY-MM (e.g., '2024-08')
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
monthYes

Implementation Reference

  • The 'what_was_i_thinking' tool handler, which summarizes conversational activity for a specific month.
    @mcp.tool()
    def what_was_i_thinking(month: str) -> str:
        """
        Time-travel snapshot: What was on your mind during a specific month?
        Format: YYYY-MM (e.g., '2024-08')
        """
        con = get_conversations()
        try:
            year, mon = month.split("-")
            year, mon = int(year), int(mon)
        except Exception:
            return f"Invalid month format. Use YYYY-MM (e.g., '2024-08')"
    
        stats = con.execute("""
            SELECT COUNT(*) as total_msgs,
                   COUNT(DISTINCT conversation_id) as convos,
                   SUM(CASE WHEN role='user' THEN 1 ELSE 0 END) as user_msgs,
                   SUM(CASE WHEN has_question=1 AND role='user' THEN 1 ELSE 0 END) as questions_asked
            FROM conversations WHERE year = ? AND month = ?
        """, [year, mon]).fetchone()
        total_msgs, convos, user_msgs, questions = stats
    
        if total_msgs == 0:
            return f"No data found for {month}"
    
        avg_query = """
            SELECT AVG(monthly_count) FROM (
                SELECT COUNT(*) as monthly_count FROM conversations GROUP BY year, month
            )
        """
        avg_monthly = con.execute(avg_query).fetchone()[0] or 0
    
        top_titles = con.execute("""
            SELECT conversation_title, COUNT(*) as msg_count
            FROM conversations
            WHERE year = ? AND month = ?
              AND conversation_title IS NOT NULL
              AND conversation_title != '' AND conversation_title != 'Untitled'
            GROUP BY conversation_title ORDER BY msg_count DESC LIMIT 10
        """, [year, mon]).fetchall()
    
        sample_questions = con.execute("""
            SELECT substr(content, 1, 150) as question, created
            FROM conversations
            WHERE year = ? AND month = ? AND role = 'user' AND has_question = 1
            ORDER BY created DESC LIMIT 5
        """, [year, mon]).fetchall()
    
        sources = con.execute("""
            SELECT source, COUNT(*) as count FROM conversations
            WHERE year = ? AND month = ? GROUP BY source ORDER BY count DESC
        """, [year, mon]).fetchall()
    
        activity_level = (
            "πŸ”₯ HIGH" if total_msgs > avg_monthly * 1.5
            else "πŸ“Š NORMAL" if total_msgs > avg_monthly * 0.5
            else "πŸ“‰ LOW"
        )
    
        output = [
            f"## What Was I Thinking: {month}\n",
            f"### Activity Level: {activity_level}",
            f"- **{total_msgs:,}** messages ({int(total_msgs/avg_monthly*100)}% of average)",
            f"- **{convos:,}** conversations",
            f"- **{user_msgs:,}** messages from you",
            f"- **{questions:,}** questions asked\n",
            "### Sources:"
        ]
        for source, count in sources:
            output.append(f"- {source}: {count:,}")
    
        if top_titles:
            output.append("\n### Top Conversations (themes):")
            for title, count in top_titles[:7]:
                output.append(f"- {title} ({count} msgs)")
    
        if sample_questions:
            output.append("\n### Sample Questions You Asked:")
            for q, _ in sample_questions:
                output.append(f"- \"{q}...\"")
    
        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