Skip to main content
Glama

suggest_next_actions

Provides personalized action recommendations when users appear stuck or ask 'what now?' during conversations, helping maintain engagement and progress.

Instructions

Get personalized recommendations - AUTO-SUGGEST when user seems stuck or asks 'what now?'

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
user_idNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The primary handler function for the 'suggest_next_actions' tool. It delegates to the reflection_agent's suggest_next_steps method to generate and return a list of personalized action recommendations.
    async def suggest_next_actions(user_id: str | None = None) -> list[str]:
        """
        Generate personalized action recommendations based on conversation patterns and history.
    
        ## AUTONOMOUS SUGGESTION TRIGGERS
    
        ### HIGH Priority (Offer Immediately)
        - User asks: "what now?", "what should I do next?", "what's next?"
        - User seems stuck: "I'm not sure...", "what do you think?", "hmm..."
        - Task completion: "that's done", "finished that", "what else?"
        - Repeated issues: 3+ similar questions or problems
    
        ### MEDIUM Priority (Offer Contextually)
        - After successful problem solving: "since that worked, you might also..."
        - Session start with analysis showing patterns
        - User mentions having free time or looking for projects
    
        ### Proactive Integration Examples
    
        ```python
        # User: "That's done. What should I work on now?"
        # → AUTO: suggest_next_actions()
        # → Present: "Based on our recent work, here are some suggestions..."
    
        # Analysis reveals 3 CORS questions
        # → AUTO: suggest_next_actions()
        # → Proactive: "I notice CORS keeps coming up - want to set up a permanent solution?"
    
        # User: "I'm stuck, not sure what to do next"
        # → AUTO: suggest_next_actions()
        # → Response: "Let me suggest some next steps based on your recent projects..."
        ```
    
        ## Enhanced Suggestion Types (Now with Semantic Analysis)
    
        - **Documentation**: Create guides for frequently asked topics
        - **Learning**: Resources for identified knowledge gaps
        - **Workflow**: Process improvements based on patterns
        - **Next Steps**: Logical progression in current projects
        - **Best Practices**: Improvements based on observed anti-patterns
        - **Tools**: Recommendations for tools that could help
        - **Problem Prevention**: Address recurring issues permanently
        - **Project Continuation**: Resume incomplete work
    
        ## Smart Suggestion Generation
    
        Uses semantic search to find:
        1. **Recurring Issues**: Problems that appear multiple times
        2. **Incomplete Projects**: Work that seems unfinished
        3. **Knowledge Gaps**: Areas with frequent questions
        4. **Success Patterns**: Approaches that worked well
        5. **Tool Opportunities**: Where automation could help
    
        ## Response Integration Guidelines
    
        - **Present contextually**: "Since you just finished X, you might want to..."
        - **Be specific**: Include actual examples from conversation history
        - **Prioritize impact**: Lead with suggestions that solve recurring issues
        - **Make actionable**: Each suggestion should be a clear next step
    
        Args:
            user_id: User ID to analyze (optional, defaults to DEFAULT_USER_ID)
    
        Returns:
            List of actionable suggestion strings (max 10), each being:
            - Specific and concrete with examples from history
            - Based on semantic analysis of conversation patterns
            - Prioritized by potential impact and user needs
            - Practical and immediately implementable
        """
        try:
            suggestions = await reflection_agent.suggest_next_steps(user_id=user_id)
            logger.info("Generated suggestions", count=len(suggestions))
            return suggestions
        except Exception as e:
            logger.error("Suggestion generation failed", error=str(e))
            raise RuntimeError(f"Failed to generate suggestions: {str(e)}") from e
  • Registration of the 'suggest_next_actions' tool via the @mcp.tool decorator, specifying name and description.
    @mcp.tool(
        name="suggest_next_actions",
        description="Get personalized recommendations - AUTO-SUGGEST when user seems stuck or asks 'what now?'",
    )
  • Supporting helper method in ReflectionAgent class that implements the core suggestion logic by analyzing conversations, searching memories for issues and projects, and generating actionable next steps.
    async def suggest_next_steps(self, user_id: str | None = None) -> list[str]:
        """Suggest next steps based on conversation history using semantic analysis.
    
        Args:
            user_id: User to analyze (defaults to settings)
    
        Returns:
            List of suggested next steps
        """
        user_id = user_id or settings.default_user_id
    
        try:
            # Analyze recent conversations
            analysis = await self.analyze_recent_conversations(user_id=user_id)
            insights = analysis.get("insights", [])
    
            # Search for repeated issues or incomplete projects
            issue_memories = await memory_service.search_memories(
                query="error problem issue bug failed", user_id=user_id, limit=10
            )
    
            project_memories = await memory_service.search_memories(
                query="implement build create project working on",
                user_id=user_id,
                limit=10,
            )
    
            suggestions = []
    
            # Generate suggestions from pattern analysis
            for insight in insights:
                if insight["type"] == "frequent_questions":
                    examples = insight.get("examples", [])
                    if examples:
                        topic = self._extract_topic_from_questions(examples)
                        suggestions.append(
                            f"Create a personal reference guide for {topic} - you've asked about this multiple times"
                        )
                    else:
                        suggestions.append(
                            "Consider creating a FAQ or documentation for commonly asked questions"
                        )
                elif insight["type"] == "focus_area":
                    area = insight["description"].split("on ")[1].split(" (")[0]
                    suggestions.append(
                        f"Deep dive into {area} with more structured learning resources"
                    )
                elif insight["type"] == "problem_solving_pattern":
                    suggestions.append(
                        "Try breaking down the problem into smaller, testable components"
                    )
    
            # Add suggestions based on semantic searches
            if issue_memories:
                recurring_issues = self._identify_recurring_issues(issue_memories)
                for issue in recurring_issues:
                    suggestions.append(
                        f"Document solution for recurring {issue} - appears multiple times"
                    )
    
            if project_memories:
                incomplete_projects = self._identify_incomplete_projects(
                    project_memories
                )
                for project in incomplete_projects:
                    suggestions.append(
                        f"Consider resuming work on {project} - seems unfinished"
                    )
    
            return suggestions[:10]  # Limit to top 10 suggestions
    
        except Exception as e:
            self._logger.error("Failed to suggest next steps", error=str(e))
            return []
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. While it mentions the tool provides 'personalized recommendations' and suggests usage timing, it lacks critical behavioral details: what data sources it uses (e.g., memories, conversations), whether it requires specific permissions, how it generates recommendations, or what the output format looks like. For a recommendation tool with zero annotation coverage, this is insufficient.

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 extremely concise—just one sentence with no wasted words. It's front-loaded with the core purpose ('Get personalized recommendations') followed by usage context. Every part of the description adds value, making it efficient and well-structured.

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's moderate complexity (recommendation generation), no annotations, and an output schema exists (which should document return values), the description is partially complete. It covers purpose and usage timing but misses parameter semantics and behavioral details like data sources or algorithm behavior. The presence of an output schema helps, but the description should do more for a tool that likely involves personalization logic.

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

Parameters2/5

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

The input schema has 1 parameter (user_id) with 0% description coverage in the schema itself. The tool description provides no information about this parameter—it doesn't explain what user_id represents, whether it's required, or how it affects the recommendations. With low schema coverage, the description fails to compensate, leaving the parameter's meaning unclear.

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: 'Get personalized recommendations' with the specific trigger condition 'when user seems stuck or asks 'what now?''. It uses a clear verb ('Get') and specifies the resource ('personalized recommendations'), though it doesn't explicitly distinguish from sibling tools like 'analyze_conversations' or 'search_memories' which might also provide insights.

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

Usage Guidelines4/5

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

The description provides explicit usage context: 'AUTO-SUGGEST when user seems stuck or asks 'what now?''. This gives clear guidance on when to invoke the tool. However, it doesn't specify when NOT to use it or mention alternatives among the sibling tools, which prevents a perfect score.

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/terrymunro/mcp-mitm-mem0'

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