list_summaries
Retrieve recent chat summaries from your notes directory to review past AI conversations. Specify a limit to control how many summaries appear.
Instructions
List recent chat summaries from the notes directory.
Args: limit: Maximum number of summaries to list (default: 10)
Returns: List of recent summary files with their creation dates
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Implementation Reference
- main.py:472-518 (handler)The core handler function for the 'list_summaries' MCP tool. It lists recent chat summary markdown files from the configured notes directory, sorts them by modification time (newest first), limits to the specified number, extracts display names from filenames, and formats a markdown-style list with dates and sizes. The @mcp.tool() decorator registers this function as an MCP tool.@mcp.tool() def list_summaries(limit: int = 10) -> str: """ List recent chat summaries from the notes directory. Args: limit: Maximum number of summaries to list (default: 10) Returns: List of recent summary files with their creation dates """ try: if not ensure_notes_directory(): return "Error: Could not access notes directory" # Find all chat summary files summary_files = list(NOTES_DIR.glob("chat_summary_*.md")) if not summary_files: return "No chat summaries found in the notes directory." # Sort by modification time (newest first) summary_files.sort(key=lambda x: x.stat().st_mtime, reverse=True) # Limit results summary_files = summary_files[:limit] result = f"Recent Chat Summaries (showing {len(summary_files)} of {len(list(NOTES_DIR.glob('chat_summary_*.md')))} total):\n\n" for file in summary_files: # Get file stats stat = file.stat() created = datetime.fromtimestamp(stat.st_ctime).strftime("%Y-%m-%d %H:%M") size_kb = round(stat.st_size / 1024, 1) # Try to extract title from filename name_parts = file.stem.replace("chat_summary_", "").split("_", 2) display_name = name_parts[2] if len(name_parts) > 2 else "Untitled" display_name = display_name.replace("_", " ") result += f"**{display_name}**\n" result += f" {created} | {size_kb} KB | {file.name}\n\n" return result except Exception as e: return f"Error listing summaries: {str(e)}"