set_week_theme
Configure daily work themes to guide task selection throughout the week, helping users maintain focus on specific types of work each day.
Instructions
Configure work themes for each day of the week.
Sets which type of work to focus on each day (e.g., "Fridays = strategic work"). This influences task selection in start_my_day().
Args: week_start_date_str: Monday date in YYYY-MM-DD format themes_json: JSON object with day themes, e.g.: {"monday": "sprint_work", "friday": "strategic"} focus_todo_ids: Optional comma-separated todo IDs to focus on this week
Returns: Confirmation message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| week_start_date_str | Yes | ||
| themes_json | Yes | ||
| focus_todo_ids | No |
Implementation Reference
- src/coach_ai/server.py:958-1017 (handler)The `set_week_theme` tool is registered using the `@mcp.tool()` decorator and its handler implementation directly follows in `src/coach_ai/server.py`. It takes a start date, a JSON string of themes, and optional focus IDs, validating the inputs and storing the configuration in the `week_themes` database table.
@mcp.tool() async def set_week_theme( week_start_date_str: str, themes_json: str, focus_todo_ids: Optional[str] = None, ) -> str: """Configure work themes for each day of the week. Sets which type of work to focus on each day (e.g., "Fridays = strategic work"). This influences task selection in start_my_day(). Args: week_start_date_str: Monday date in YYYY-MM-DD format themes_json: JSON object with day themes, e.g.: {"monday": "sprint_work", "friday": "strategic"} focus_todo_ids: Optional comma-separated todo IDs to focus on this week Returns: Confirmation message """ db = await storage.get_db() try: week_start = datetime.fromisoformat(week_start_date_str).date() except ValueError: return f"Error: Invalid date format. Use YYYY-MM-DD" # Verify it's a Monday if week_start.weekday() != 0: return f"Error: Date must be a Monday. {week_start} is a {week_start.strftime('%A')}" try: themes = json.loads(themes_json) except json.JSONDecodeError as e: return f"Error: Invalid JSON for themes: {e}" # Validate theme values valid_themes = ["sprint_work", "strategic", "admin", "learning", "mixed"] for day, theme in themes.items(): if theme not in valid_themes: return f"Error: Invalid theme '{theme}'. Must be one of: {', '.join(valid_themes)}" # Store in database await db.execute( """ INSERT OR REPLACE INTO week_themes (week_start_date, theme_json, focus_items) VALUES (?, ?, ?) """, (week_start, json.dumps(themes), focus_todo_ids or ""), ) await db.commit() response = f"✓ Set weekly themes for week of {week_start.strftime('%B %d, %Y')}:\n" for day, theme in themes.items(): response += f" {day.capitalize()}: {theme}\n" if focus_todo_ids: response += f"\nFocus items: {focus_todo_ids}" return response