list_daily_notes
Retrieve recent daily notes from your Obsidian vault to track daily activities and maintain organized documentation.
Instructions
List recent daily notes
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| folder | No | Daily Notes | |
| limit | No |
Implementation Reference
- src/obsidian_mcp/vault.py:705-742 (handler)Core handler function implementing the logic to list recent daily notes by filtering notes with YYYY-MM-DD.md filenames within the specified days_back, sorting by modification time (newest first), and limiting the results.def list_daily_notes( self, folder: str = "Daily Notes", limit: int = 30, days_back: int = 90 ) -> list[NoteMetadata]: """ List recent daily notes. Args: folder: Folder where daily notes are stored limit: Maximum number of notes to return days_back: How many days back to search Returns: List of daily notes sorted by date (newest first) """ notes = self.list_notes(folder=folder, recursive=False, limit=None) # Filter to date-formatted notes (YYYY-MM-DD.md) date_pattern = re.compile(r"^\d{4}-\d{2}-\d{2}\.md$") daily_notes = [] cutoff_date = date.today() - timedelta(days=days_back) for note in notes: filename = Path(note.path).name if date_pattern.match(filename): # Parse date from filename try: note_date = datetime.strptime(filename[:-3], "%Y-%m-%d").date() if note_date >= cutoff_date: daily_notes.append(note) except ValueError: continue # Sort by modification time (newest first) daily_notes.sort(key=lambda n: n.modified, reverse=True) return daily_notes[:limit]
- src/obsidian_mcp/server.py:804-838 (registration)MCP tool registration with @mcp.tool decorator. Wrapper function that calls the vault handler, handles errors, and formats the output as a human-readable string list.@mcp.tool(name="list_daily_notes", description="List recent daily notes") def list_daily_notes(folder: str = "Daily Notes", limit: int = 30) -> str: """ List recent daily notes. Args: folder: Folder where daily notes are stored limit: Maximum number of notes (default: 30) Returns: Formatted list of daily notes """ if limit <= 0 or limit > 365: return "Error: Limit must be between 1 and 365" context = _get_context() try: notes = context.vault.list_daily_notes(folder, limit) if not notes: return f"No daily notes found in '{folder}'" output = f"Found {len(notes)} daily note(s) in '{folder}':\n\n" for i, note in enumerate(notes, 1): output += f"{i}. **{note.name}**\n" output += f" Path: `{note.path}`\n" output += f" Size: {note.size} bytes\n\n" return output except Exception as e: logger.exception("Error listing daily notes") return f"Error listing daily notes: {e}"