Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/basic_memory/mcp/prompts/recent_activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ async def recent_activity_prompt(
Returns:
Formatted summary of recent activity
"""
timeframe = timeframe or "7d"
logger.info(f"Getting recent activity, timeframe: {timeframe}, project: {project}")

# Call the tool function - it returns a well-formatted string
# Pass type as string values (not enum) to match the tool's expected input
activity_summary = await recent_activity.fn(project=project, timeframe=timeframe, type="entity")
activity_summary = await recent_activity.fn(project=project, timeframe=timeframe)

# Build the prompt response
# The tool already returns formatted markdown, so we use it directly
Expand Down
19 changes: 18 additions & 1 deletion tests/mcp/test_recent_activity_prompt_modes.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,21 @@ async def fake_fn(**kwargs):

assert captured_kwargs["timeframe"] == "2d"
assert captured_kwargs["project"] == "test-proj"
assert captured_kwargs["type"] == "entity"
assert "type" not in captured_kwargs


@pytest.mark.asyncio
async def test_recent_activity_prompt_defaults_timeframe(monkeypatch):
"""Prompt should fall back to 7d when timeframe omitted or falsy."""
captured_kwargs = {}

async def fake_fn(**kwargs):
captured_kwargs.update(kwargs)
return "## Recent Activity"

monkeypatch.setattr("basic_memory.mcp.prompts.recent_activity.recent_activity.fn", fake_fn)

await recent_activity_prompt.fn(timeframe=None, project=None) # pyright: ignore[reportGeneralTypeIssues]

assert captured_kwargs["timeframe"] == "7d"
assert captured_kwargs["project"] is None
Loading