Commit c951aed
refactor(mcp): convert continue_conversation.py to context manager pattern
Convert continue_conversation MCP prompt from module-level client import to
the new get_client() context manager pattern, enabling proper dependency injection.
Changes:
- Import get_client() instead of client from async_client module
- Wrap function body in 'async with get_client() as client:' block
- Indent all code inside context manager (lines 45-62)
- Update SPEC-16 checklist (15 of 16 main tools converted)
The continue_conversation prompt helps users continue conversations and work
across sessions by:
- Finding recent context about specific topics
- Showing general recent activity with timeframe filtering
- Providing context from previous sessions to maintain continuity
- Supporting session continuation in MCP-enabled AI assistants
This conversion maintains the prompt's session continuation functionality while:
- Ensuring proper client lifecycle management
- Enabling cloud app to inject custom transport via factory
- Allowing tests to mock client behavior
- Following httpx best practices for async context managers
- Moving auth to client creation instead of per-request
Testing:
- Typecheck passed (0 errors, 0 warnings)
- Prompt function properly scoped (client inside async with block)
Part of Phase 0.3: Converting 16 MCP tools/prompts to context manager pattern.
Related to SPEC-16 MCP Cloud Service Consolidation.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>1 parent 7856dd4 commit c951aed
2 files changed
Lines changed: 17 additions & 16 deletions
File tree
- specs
- src/basic_memory/mcp/prompts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
462 | 462 | | |
463 | 463 | | |
464 | 464 | | |
| 465 | + | |
465 | 466 | | |
466 | | - | |
467 | 467 | | |
468 | 468 | | |
469 | 469 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
49 | 50 | | |
50 | | - | |
| 51 | + | |
51 | 52 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
58 | 59 | | |
59 | | - | |
60 | | - | |
61 | | - | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments