Skip to main content
Glama

get_recent_memento_activity

Retrieve recent memory activity summaries including memory counts, recent entries, and unresolved problems for session context analysis.

Instructions

Get summary of recent memento activity for session context.

Returns: memory counts by type, recent memories (up to 20), unresolved problems.

EXAMPLES:

  • get_recent_memento_activity(days=7) - last week's activity

  • get_recent_memento_activity(days=30, project="/app") - last month for specific project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
daysNoNumber of days to look back (default: 7)
projectNoOptional: Filter by project path

Implementation Reference

  • The handle_get_recent_memento_activity function retrieves activity data from the memory_db and formats it into a CallToolResult. It includes optional project-based filtering and a timeout-protected project detection mechanism.
    async def handle_get_recent_memento_activity(
        memory_db: SQLiteMemoryDatabase, arguments: Dict[str, Any]
    ) -> CallToolResult:
        """Handle get_recent_activity tool call.
    
        Args:
            memory_db: Database instance for memory operations
            arguments: Tool arguments from MCP call containing:
                - days: Number of days to look back (default: 7)
                - project: Optional project path to filter by
    
        Returns:
            CallToolResult with formatted activity summary or error message
        """
        # Check if database supports get_recent_activity
        if not hasattr(memory_db, "get_recent_activity"):
            return CallToolResult(
                content=[
                    TextContent(
                        type="text",
                        text="Recent activity summary is not supported by this backend",
                    )
                ],
                isError=True,
            )
    
        days = arguments.get("days", 7)
        project = arguments.get("project")
    
        # Auto-detect project only when explicitly not provided.
        # Run in a thread with a hard timeout; on Windows git subprocesses can
        # linger after TimeoutExpired, so we cap the whole operation at 0.5 s
        # and discard the result on any failure — project detection is best-effort.
        if not project:
            try:
                from ..utils.project_detection import detect_project_context
    
                loop = asyncio.get_event_loop()
                executor = ThreadPoolExecutor(max_workers=1)
    
                try:
                    future = loop.run_in_executor(executor, detect_project_context)
                    project_info = await asyncio.wait_for(future, timeout=0.5)
    
                    if project_info:
                        project = project_info.get("project_path")
    
                finally:
                    # Shut down without waiting so zombie git processes don't block
                    executor.shutdown(wait=False, cancel_futures=True)
    
            except Exception:
                # Project detection is best-effort; continue without it
                pass
    
        activity = await memory_db.get_recent_activity(days=days, project=project)
    
        # Format results
        result_text = f"**Recent Activity Summary (Last {days} days)**\n\n"
    
        if project:
            result_text += f"**Project**: {project}\n\n"
    
        # Total count
        result_text += f"**Total Memories**: {activity['total_count']}\n\n"
    
        # Memories by type
        if activity["memories_by_type"]:
            result_text += "**Breakdown by Type**:\n"
    
            for mem_type, count in sorted(
                activity["memories_by_type"].items(), key=lambda x: x[1], reverse=True
            ):
                result_text += f"- {mem_type.replace('_', ' ').title()}: {count}\n"
    
            result_text += "\n"
    
        # Unresolved problems
        if activity["unresolved_problems"]:
            result_text += (
                f"**⚠️ Unresolved Problems ({len(activity['unresolved_problems'])})**:\n"
            )
    
            for problem in activity["unresolved_problems"]:
                title = _get_memory_attr(problem, "title", "Unknown")
                importance = _get_memory_attr(problem, "importance", 0.5)
                summary = _get_memory_attr(problem, "summary")
                result_text += f"- **{title}** (importance: {importance:.1f})\n"
    
                if summary:
                    result_text += f"  {summary}\n"
    
            result_text += "\n"
    
        # Recent memories
        if activity["recent_memories"]:
            result_text += f"**Recent Memories** (showing {min(10, len(activity['recent_memories']))}):\n"
    
            for i, memory in enumerate(activity["recent_memories"][:10], 1):
                title = _get_memory_attr(memory, "title", "Unknown")
                mem_type = _get_memory_attr(memory, "type", "general")
                summary = _get_memory_attr(memory, "summary")
                result_text += f"{i}. **{title}** ({mem_type})\n"
    
                if summary:
                    result_text += f"   {summary}\n"
    
            result_text += "\n"
    
        # Next steps suggestion
        result_text += "**💡 Next Steps**:\n"
    
        if activity["unresolved_problems"]:
            result_text += "- Review unresolved problems and consider solutions\n"
            result_text += '- Use `get_memento(memory_id="...")` for details\n'
        else:
            result_text += "- All problems have been addressed!\n"
    
        return CallToolResult(content=[TextContent(type="text", text=result_text)])
  • The get_recent_memento_activity tool is defined in definitions.py, providing the name and description used for tool registration in the MCP protocol.
    name="get_recent_memento_activity",
Behavior3/5

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

No annotations provided, so description carries full burden. Discloses return structure composition (counts by type, up to 20 recent memories, unresolved problems) which is valuable. However, fails to declare read-only nature or safety characteristics despite many mutating siblings (delete, update, store).

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?

Excellent structure with clear sections: purpose statement, Returns description, and EXAMPLES. Front-loaded with zero waste. Each sentence earns its place by conveying distinct information.

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

Completeness4/5

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

Compensates well for missing output schema by explicitly documenting return components and the 20-item limit. With only 2 simple parameters fully documented in schema, complete coverage achieved. Minor gap: could declare read-only status given lack of annotations.

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?

Schema coverage is 100% providing complete param documentation. Examples section adds valuable usage context clarifying that days looks back in time and project filters by path, exceeding baseline expectations for high-coverage schemas.

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?

States specific action (Get summary), resource (memento activity), and scope (recent, session context). Mentions return of 'unresolved problems' which distinguishes from sibling get_memento_statistics. However, 'session context' is vague and doesn't explicitly contrast with search_mementos or contextual_memento_search.

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

Usage Guidelines3/5

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

Provides concrete examples showing usage patterns (days=7, project filter), which implicitly guide usage. However, lacks explicit 'when to use this vs alternatives' guidance. Doesn't clarify when to prefer this over search_mementos or get_memento_statistics.

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/x-hannibal/mcp-memento'

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