Skip to main content
Glama
madebygps

Obsidian Diary MCP Server

by madebygps

create_diary_template

Generate a personalized diary template with reflection prompts based on your recent journal entries to maintain consistent daily writing habits.

Instructions

Create a new diary entry template with reflection prompts based on recent entries.

Args: date: Date for the entry in YYYY-MM-DD format. If not provided, uses today's date.

Returns: A formatted diary template with reflection prompts

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dateNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Handler function for 'create_diary_template' tool. Registered via @mcp.tool() decorator. Validates input, checks for existing entry, generates template via template_generator.
    @mcp.tool(
        annotations={
            "title": "Preview Memory Log Template",
            "readOnlyHint": True,
            "openWorldHint": False
        }
    )
    async def create_diary_template(
        date: Annotated[str, "REQUIRED: Current date in YYYY-MM-DD format. For 'today', pass the current system date like '2025-10-07'"],
        focus: Annotated[str | None, "Optional focus area (e.g., 'current struggles', 'cognitive patterns')"] = None
    ) -> str:
        """Create a sophisticated diary template with intellectually rigorous prompts for deep cognitive exploration."""
        try:
            entry_date = datetime.strptime(date, "%Y-%m-%d")
        except ValueError:
            return "Error: Date must be in YYYY-MM-DD format"
    
        if entry_manager.entry_exists(entry_date):
            return f"Memory log for {date} already exists. Use read_diary_entry to view it."
    
        return await template_generator.generate_template_content(entry_date, date, focus)
  • Core logic for generating diary template content. Analyzes recent entries, generates AI reflection prompts via analysis_engine, builds template structure. Called by the tool handler.
    async def generate_template_content(
        self,
        entry_date: datetime,
        filename: str,
        focus: Optional[str] = None
    ) -> str:
        """Generate template content for a diary entry."""
        from datetime import timedelta
        
        log_section(logger, f"Template Generation: {filename}")
        logger.info(f"Entry date: {entry_date.strftime('%A, %B %d, %Y')}")
        
        is_sunday = entry_date.weekday() == 6
        
        if is_sunday:
            week_start = entry_date - timedelta(days=7)
            all_entries = entry_manager.get_all_entries()
            recent_entries = [(date, path) for date, path in all_entries if week_start <= date < entry_date]
            logger.info(f"Sunday reflection: Analyzing {len(recent_entries)} entries from {week_start.strftime('%Y-%m-%d')} to {(entry_date - timedelta(days=1)).strftime('%Y-%m-%d')}")
        else:
            three_days_ago = entry_date - timedelta(days=3)
            all_entries = entry_manager.get_all_entries()
            recent_entries = [(date, path) for date, path in all_entries if three_days_ago <= date < entry_date]
            logger.info(f"Regular day: Analyzing {len(recent_entries)} entries from past 3 calendar days ({three_days_ago.strftime('%Y-%m-%d')} to {(entry_date - timedelta(days=1)).strftime('%Y-%m-%d')})")
        
        recent_text = "\n\n".join(
            f"## {'MOST RECENT ENTRY' if i == 0 else 'Earlier entry'} ({date.strftime('%Y-%m-%d')}):\n{entry_manager.read_entry(path)}"
            for i, (date, path) in enumerate(recent_entries)
        )
        logger.info(f"Context: {len(recent_text):,} chars from {len(recent_entries)} entries (weighted by recency)")
        
        prompt_count = 5 if is_sunday else 3
        logger.info(f"Requesting {prompt_count} AI-generated prompts{' with focus: ' + focus if focus else ''}")
        
        prompts = await analysis_engine.generate_reflection_prompts(
            recent_text, focus, prompt_count, is_sunday
        )
        
        if not prompts:
            logger.warning("No AI prompts generated, using fallback prompts")
            prompts = self._get_fallback_prompts(is_sunday)
        else:
            logger.info(f"✓ Generated {len(prompts)} AI prompts successfully")
    
        return self._build_template(prompts, is_sunday)
  • @mcp.tool() decorator registers the create_diary_template function as an MCP tool with metadata annotations.
    @mcp.tool(
        annotations={
            "title": "Preview Memory Log Template",
            "readOnlyHint": True,
            "openWorldHint": False
        }
    )
  • Function signature with Annotated types defining input schema and descriptions for the tool.
    async def create_diary_template(
        date: Annotated[str, "REQUIRED: Current date in YYYY-MM-DD format. For 'today', pass the current system date like '2025-10-07'"],
        focus: Annotated[str | None, "Optional focus area (e.g., 'current struggles', 'cognitive patterns')"] = None
    ) -> str:
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool creates a template, implying a write operation, but doesn't mention permissions, side effects, or error handling. The mention of 'based on recent entries' hints at data access, but lacks details on how this influences the template generation.

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 front-loaded with the core purpose, followed by clear sections for Args and Returns. Every sentence adds value without redundancy, making it efficient and well-structured for quick understanding.

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

Completeness4/5

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

Given the tool has an output schema (covering return values), no annotations, and low schema coverage, the description does a good job by explaining the parameter and return purpose. However, as a creation tool with no behavioral annotations, it could benefit from more context on permissions or side effects to be fully complete.

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 significant meaning beyond the input schema, which has 0% description coverage. It explains the 'date' parameter's purpose, format (YYYY-MM-DD), and default behavior (uses today's date if not provided), compensating well for the schema's lack of documentation.

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 verb 'Create' and resource 'new diary entry template', specifying it includes 'reflection prompts based on recent entries'. However, it doesn't explicitly differentiate from sibling tools like 'save_diary_entry' or 'update_entry_backlinks', which might also involve diary entry creation or modification.

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?

No guidance is provided on when to use this tool versus alternatives like 'save_diary_entry' or 'update_entry_backlinks'. The description mentions 'based on recent entries', but doesn't specify prerequisites or exclusions, leaving the agent to infer usage context.

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

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/madebygps/obsidian-diary-mcp'

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