Skip to main content
Glama

zk_list_notes_by_date

Filter and retrieve notes from a Zettelkasten system within a specified date range. Supports searching by creation or update dates and allows limiting results for efficient note organization.

Instructions

List notes created or updated within a date range. Args: start_date: Start date in ISO format (YYYY-MM-DD) end_date: End date in ISO format (YYYY-MM-DD) use_updated: Whether to use updated_at instead of created_at limit: Maximum number of results to return

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
end_dateNo
limitNo
start_dateNo
use_updatedNo

Implementation Reference

  • Main handler function implementing the zk_list_notes_by_date tool logic: parses input dates, queries search_service for notes in range, applies limit, formats and returns a detailed list.
    def zk_list_notes_by_date(
        start_date: str | None = None,
        end_date: str | None = None,
        use_updated: bool = False,
        limit: int = 10,
    ) -> str:
        """List notes created or modified within a specific date range.
    
        Args:
            start_date: Start of date range in ISO format YYYY-MM-DD (optional, defaults to earliest)
            end_date: End of date range in ISO format YYYY-MM-DD (optional, defaults to latest)
            use_updated: If true, filter by modification date instead of creation date (default: false)
            limit: Maximum number of results to return (default: 10)
        """
        try:
            # Parse dates
            start_datetime = None
            if start_date:
                start_datetime = datetime.fromisoformat(f"{start_date}T00:00:00")
            end_datetime = None
            if end_date:
                end_datetime = datetime.fromisoformat(f"{end_date}T23:59:59")
    
            # Get notes
            notes = self.search_service.find_notes_by_date_range(
                start_date=start_datetime,
                end_date=end_datetime,
                use_updated=use_updated,
            )
    
            # Limit results
            notes = notes[:limit]
            if not notes:
                date_type = "updated" if use_updated else "created"
                date_range = ""
                if start_date and end_date:
                    date_range = f" between {start_date} and {end_date}"
                elif start_date:
                    date_range = f" after {start_date}"
                elif end_date:
                    date_range = f" before {end_date}"
                return f"No notes found {date_type}{date_range}."
    
            # Format results
            date_type = "updated" if use_updated else "created"
            output = f"Notes {date_type}"
            if start_date or end_date:
                if start_date and end_date:
                    output += f" between {start_date} and {end_date}"
                elif start_date:
                    output += f" after {start_date}"
                elif end_date:
                    output += f" before {end_date}"
            output += f" (showing {len(notes)} results):\n\n"
            for i, note in enumerate(notes, 1):
                date = note.updated_at if use_updated else note.created_at
                output += f"{i}. {note.title} (ID: {note.id})\n"
                output += f"   {date_type.capitalize()}: {date.strftime('%Y-%m-%d %H:%M')}\n"
                if note.tags:
                    output += (
                        f"   Tags: {', '.join(tag.name for tag in note.tags)}\n"
                    )
                # Add a snippet of content (first 100 chars)
                content_preview = note.content[:100].replace("\n", " ")
                if len(note.content) > 100:
                    content_preview += "..."
                output += f"   Preview: {content_preview}\n\n"
            return output
        except ValueError as e:
            # Special handling for date parsing errors
            logger.error(f"Date parsing error: {str(e)}")
            return f"Error parsing date: {str(e)}"
        except Exception as e:
            return self.format_error_response(e)
  • MCP tool registration decorator defining the tool name, description, and annotations indicating it's read-only and idempotent.
    @self.mcp.tool(
        name="zk_list_notes_by_date",
        description="List notes created or modified within a specific date range.",
        annotations={
            "readOnlyHint": True,
            "destructiveHint": False,
            "idempotentHint": True,
        },
    )
  • Supporting helper method in SearchService that filters and sorts all notes by creation or update date within the given range.
    def find_notes_by_date_range(
        self,
        start_date: Optional[datetime] = None,
        end_date: Optional[datetime] = None,
        use_updated: bool = False
    ) -> List[Note]:
        """Find notes created or updated within a date range."""
        all_notes = self.zettel_service.get_all_notes()
        matching_notes = []
        
        for note in all_notes:
            # Get the relevant date
            date = note.updated_at if use_updated else note.created_at
            
            # Check if in range
            if start_date and date < start_date:
                continue
            if end_date and date >= end_date + datetime.timedelta(seconds=1):
                continue
            
            matching_notes.append(note)
        
        # Sort by date (descending)
        matching_notes.sort(
            key=lambda x: x.updated_at if use_updated else x.created_at,
            reverse=True
        )
        
        return matching_notes
  • Input schema defined by function parameters with type annotations and defaults, output str.
    def zk_list_notes_by_date(
        start_date: str | None = None,
        end_date: str | None = None,
        use_updated: bool = False,
        limit: int = 10,
    ) -> str:
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While it mentions the tool lists notes, it doesn't cover critical aspects like whether this is a read-only operation, how results are ordered, what happens if no notes match, or if there are rate limits. For a listing tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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?

The description is efficiently structured: a clear purpose statement followed by a bullet-point list of parameters with brief explanations. Every sentence earns its place, and there's no redundant or verbose content, making it easy to parse quickly.

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

Completeness3/5

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

Given the tool's moderate complexity (4 parameters, no output schema, no annotations), the description is partially complete. It covers the purpose and parameters well but lacks behavioral details (e.g., ordering, pagination, error handling) and usage context relative to siblings. Without an output schema, it also doesn't describe return values, which is a notable gap for a listing tool.

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?

The description adds substantial value beyond the input schema, which has 0% description coverage. It explains all four parameters concisely: 'start_date' and 'end_date' as ISO format dates, 'use_updated' as a boolean for choosing between creation or update timestamps, and 'limit' as a maximum result count. This compensates well for the schema's lack of descriptions.

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?

The description clearly states the tool's purpose: 'List notes created or updated within a date range.' This specifies the verb ('list'), resource ('notes'), and scope ('within a date range'), making it easy to understand what the tool does. However, it doesn't explicitly differentiate from sibling tools like 'zk_search_notes' or 'zk_find_similar_notes', which prevents a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. With siblings like 'zk_search_notes' and 'zk_find_similar_notes' available, there's no indication of when date-range filtering is preferred over other search methods, nor any mention of prerequisites or exclusions.

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

Related 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/Liam-Deacon/zettelkasten-mcp'

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