Skip to main content
Glama

sync_daily_note

Sync completed tasks from Obsidian daily notes to Coach AI's database using markdown checkboxes, enabling bidirectional task management for productivity workflows.

Instructions

Sync completed tasks from Obsidian daily note to database.

NEW TOOL - Bidirectional sync: Reads markdown checkboxes (- [x]) from your daily note and automatically marks matching todos as complete in the database. Uses fuzzy matching to handle partial text matches.

This enables an Obsidian-first workflow: work in your daily note, check off tasks there, then sync back to Coach AI's database.

Args: date_str: Optional date in YYYY-MM-DD format (defaults to today)

Returns: Summary of tasks synced and any warnings about unmatched checkboxes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
date_strNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core implementation of the sync_daily_note logic which interacts with the Obsidian vault and the database to update task statuses.
    async def sync_daily_note(date_str: str = None) -> str:
        """Sync completed tasks from Obsidian daily note to database.
    
        NEW TOOL - Bidirectional sync:
        Reads markdown checkboxes from daily note and marks matching
        todos as complete in the database.
    
        Args:
            date_str: Optional date in YYYY-MM-DD format (defaults to today)
    
        Returns:
            Summary of synced tasks
        """
        vault = get_vault()
        if not vault:
            return "❌ Obsidian vault not configured."
    
        if date_str:
            try:
                target_date = datetime.strptime(date_str, "%Y-%m-%d").date()
            except ValueError:
                return f"❌ Invalid date format: {date_str}"
        else:
            target_date = date.today()
    
        db = await get_db()
    
        sync_result = await _sync_completed_tasks(vault, target_date, db)
    
        result = f"📝 Synced daily note for {target_date.strftime('%Y-%m-%d')}\n\n"
    
        if sync_result["completed_count"] > 0:
            result += f"✅ Marked {sync_result['completed_count']} tasks complete:\n"
            for task in sync_result["completed_tasks"]:
                result += f"   - {task}\n"
        else:
            result += "No new completed tasks found.\n"
    
        if sync_result["warnings"]:
            result += f"\n⚠️  {len(sync_result['warnings'])} checkboxes couldn't be matched to todos\n"
    
        return result
  • MCP tool registration for sync_daily_note which delegates execution to the daily_notes module.
    @mcp.tool()
    async def sync_daily_note(date_str: str = None) -> str:
        """Sync completed tasks from Obsidian daily note to database.
    
        NEW TOOL - Bidirectional sync:
        Reads markdown checkboxes (- [x]) from your daily note and automatically
        marks matching todos as complete in the database. Uses fuzzy matching to
        handle partial text matches.
    
        This enables an Obsidian-first workflow: work in your daily note, check
        off tasks there, then sync back to Coach AI's database.
    
        Args:
            date_str: Optional date in YYYY-MM-DD format (defaults to today)
    
        Returns:
            Summary of tasks synced and any warnings about unmatched checkboxes
        """
        return await daily_notes.sync_daily_note(date_str)
  • Internal helper _sync_completed_tasks that performs the actual database operations and fuzzy matching for the sync.
    async def _sync_completed_tasks(
        vault: ObsidianVault, target_date: date, db: aiosqlite.Connection
    ) -> dict:
        """Internal helper to sync completed tasks from daily note.
    
        Returns:
            Dict with completed_count, completed_tasks list, and warnings
        """
        note_data = vault.read_daily_note(datetime.combine(target_date, datetime.min.time()))
    
        if not note_data:
            return {"completed_count": 0, "completed_tasks": [], "warnings": []}
    
        completed_checkboxes = [
            task for task in note_data.get("tasks", []) if task.get("completed")
        ]
    
        if not completed_checkboxes:
            return {"completed_count": 0, "completed_tasks": [], "warnings": []}
    
        # Get all active todos from database
        cursor = await db.execute(
            "SELECT id, title FROM todos WHERE status = 'active'"
        )
        active_todos = {row["id"]: row["title"] for row in await cursor.fetchall()}
    
        completed_tasks = []
        warnings = []
    
        for checkbox in completed_checkboxes:
            checkbox_text = checkbox["text"]
    
            # Try to match checkbox to a todo
            matched_id = _fuzzy_match_task(checkbox_text, active_todos)
    
            if matched_id:
                # Mark as complete
                await db.execute(
                    "UPDATE todos SET status = 'completed', completed_at = ? WHERE id = ?",
                    (datetime.now().isoformat(), matched_id),
                )
                completed_tasks.append(active_todos[matched_id])
            else:
                warnings.append(checkbox_text)
    
        await db.commit()
    
        return {
            "completed_count": len(completed_tasks),
            "completed_tasks": completed_tasks,
            "warnings": warnings,
        }
Behavior3/5

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

With no annotations, the description carries full burden. It adequately explains the fuzzy matching logic and return value ('Summary of tasks synced and any warnings about unmatched checkboxes'), but fails to disclose that this is a destructive write operation (modifying todo completion status) or clarify the unsupported 'bidirectional' claim.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Structure is logical with Args/Returns sections, but the 'NEW TOOL' label is implementation noise that doesn't help agents. The 'Bidirectional sync' claim creates confusion since only the Obsidian→Database direction is described. Otherwise efficient.

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?

Adequate for basic operation: explains the matching behavior and output. However, lacks error handling details (what if daily note doesn't exist?) and the bidirectional claim remains unexplained. Given the complexity of fuzzy matching and file I/O, more behavioral context would be helpful.

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?

Schema coverage is 0% (no descriptions in JSON schema), but the text compensates effectively via the 'Args' section documenting date_str as 'Optional date in YYYY-MM-DD format (defaults to today)'. Clear format specification and default behavior are provided.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Excellent specificity: states the exact action (sync completed tasks), source (Obsidian daily note with markdown checkboxes - [x]), target (database), and mechanism (fuzzy matching). Clearly distinguishes from generic todo tools by specifying the Obsidian integration pattern.

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

Usage Guidelines3/5

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

Provides workflow context ('Obsidian-first workflow: work in your daily note...then sync back'), implying when to use it. However, fails to differentiate from sibling tool 'sync_from_daily_note' which has a nearly identical name, risking incorrect tool selection.

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/94aharris/coach-ai'

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