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

Implementation Reference

  • Registers the 'suggest_next_actions' tool using the @mcp.tool decorator with name and description.
    @mcp.tool( name="suggest_next_actions", description="Get personalized recommendations - AUTO-SUGGEST when user seems stuck or asks 'what now?'", )
  • The main handler function for the MCP tool 'suggest_next_actions'. It calls the reflection agent's suggest_next_steps method and handles errors.
    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
  • Core helper method implementing the suggestion logic: analyzes recent conversations, searches for issues and projects, identifies patterns, and generates personalized action recommendations.
    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 []

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