Skip to content

Commit c48aa62

Browse files
committed
src: refactored tools for more efficient use
1 parent 58e97da commit c48aa62

File tree

8 files changed

+1445
-195
lines changed

8 files changed

+1445
-195
lines changed

README.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,10 @@ The MCP provides specific tools that your AI can use. Simply ask your AI to help
215215

216216
| What you might ask | Tools the AI will use |
217217
|-------------------|----------------------|
218-
| *"What tasks do I have today?"* | `get_tasks()` |
218+
| *"What should I focus on today?"* | `get_daily_productivity_overview()` |
219+
| *"What tasks do I have today?"* | `get_daily_productivity_overview()` or `get_tasks()` |
219220
| *"Show me my projects"* | `get_projects()` |
220-
| *"What's overdue?"* | `get_due_items()` |
221+
| *"What's overdue?"* | `get_due_items()` or `get_daily_productivity_overview()` |
221222
| *"Create a new task for X"* | `create_task()` |
222223
| *"Mark task Y as done"* | `mark_task_done()` |
223224
| *"Start tracking time on this"* | `start_time_tracking()` |
@@ -426,41 +427,43 @@ pytest tests/ # Tests
426427
```
427428

428429
### 🔄 Available Tools
429-
The MCP provides 27 comprehensive tools to AI assistants:
430+
The MCP provides 25 comprehensive tools to AI assistants:
430431

431432
**📖 Read Operations:**
432-
- `get_tasks()` - Today's scheduled items
433+
- `get_daily_productivity_overview()` - **PRIMARY** comprehensive daily view (today's tasks, overdue, completed, planning insights)
434+
- `get_tasks()` - Today's scheduled items only
433435
- `get_projects()` - All projects
434436
- `get_categories()` - All categories
435-
- `get_due_items()` - Overdue/due items
436-
- `get_child_tasks()` - Subtasks
437+
- `get_due_items()` - Overdue/due items only
438+
- `get_child_tasks(parent_id: str, recursive: bool = False)` - Subtasks of a parent task/project
439+
- `get_all_tasks(label: str = None)` - Find all tasks with optional label filter (comprehensive search)
437440
- `get_labels()` - Task labels
438441
- `get_goals()` - Goals and objectives
439442
- `get_account_info()` - Account details
440-
- `get_completed_tasks()` - Completed items with date categorization
441-
- `get_completed_tasks_for_date()` - Completed items for specific date
442-
- `get_productivity_summary_for_time_range()` - Flexible productivity analytics (by days, or start/end dates)
443+
- `get_completed_tasks()` - Completed items with date categorization (defaults to past 7 days)
444+
- `get_completed_tasks_for_date(date: str)` - Completed items for specific date (YYYY-MM-DD format)
445+
- `get_productivity_summary_for_time_range(days: int = 7, start_date: str = None, end_date: str = None)` - Flexible productivity analytics
443446
- `get_currently_tracked_item()` - Active time tracking
444447

445448
**✏️ Write Operations:**
446-
- `create_task()` - Create new tasks
447-
- `mark_task_done()` - Complete tasks
448-
- `create_project()` - Create new projects
449-
- `start_time_tracking()` - Begin time tracking
450-
- `stop_time_tracking()` - End time tracking
451-
- `batch_mark_done()` - Complete multiple tasks
452-
- `batch_create_tasks()` - Create multiple tasks
453-
- `claim_reward_points()` - Claim kudos points
449+
- `create_task(title: str, project_id: str = None, category_id: str = None, due_date: str = None, note: str = None)` - Create new tasks
450+
- `mark_task_done(item_id: str, timezone_offset: int = 0)` - Complete tasks
451+
- `create_project(title: str, project_type: str = "project")` - Create new projects
452+
- `start_time_tracking(task_id: str)` - Begin time tracking
453+
- `stop_time_tracking(task_id: str)` - End time tracking
454+
- `batch_mark_done(task_ids: list[str])` - Complete multiple tasks
455+
- `batch_create_tasks(task_list: list[str], project_id: str = None, category_id: str = None)` - Create multiple tasks
456+
- `claim_reward_points(points: int, item_id: str, date: str)` - Claim kudos points
454457

455458
**🔧 Utility Operations:**
456459
- `test_api_connection()` - Verify API connectivity
457-
- `get_project_overview()` - Project analytics
460+
- `get_project_overview(project_id: str)` - Project analytics
458461
- `get_daily_focus()` - Daily priorities
459462
- `get_productivity_summary()` - Performance metrics
460463
- `time_tracking_summary()` - Time analytics
461464
- `quick_daily_planning()` - Planning assistance
462-
- `create_project_with_tasks()` - Project setup
463-
- `get_time_tracks()` - Time tracking history
465+
- `create_project_with_tasks(project_title: str, task_titles: list[str], project_type: str = "project")` - Project setup
466+
- `get_time_tracks(task_ids: list[str])` - Time tracking history
464467

465468
## 🤝 Contributing
466469

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "amazing-marvin-mcp"
7-
version = "0.1.11"
7+
version = "1.0.0"
88
description = "Amazing Marvin Model Context Provider"
99
readme = "README.md"
1010
requires-python = ">=3.10"

src/amazing_marvin_mcp/analytics.py

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,101 @@ def _process_date_data(
250250
range_summary["tasks_by_date"][date_str] = []
251251

252252

253+
def get_daily_productivity_overview(api_client: MarvinAPIClient) -> dict[str, Any]:
254+
"""Get comprehensive daily productivity overview combining focus, planning, and progress.
255+
256+
Consolidates functionality from get_productivity_summary, quick_daily_planning, and get_daily_focus
257+
to reduce API calls from 11 to 5 for better performance.
258+
259+
Returns today's tasks, overdue items, completed items, planning insights, and productivity metrics.
260+
"""
261+
today = DateUtils.get_today()
262+
263+
# Make efficient API calls (5 total instead of 11)
264+
today_items = api_client.get_tasks() # Today's scheduled items
265+
due_items = api_client.get_due_items() # Overdue/due items
266+
today_completed = api_client.get_done_items() # Today's completed items
267+
projects = api_client.get_projects() # For project context
268+
goals = api_client.get_goals() # For goal progress
269+
270+
# Combine pending items (removing duplicates)
271+
all_pending_items = []
272+
item_ids = set()
273+
274+
for item in today_items + due_items:
275+
item_id = item.get("_id")
276+
if item_id and item_id not in item_ids:
277+
all_pending_items.append(item)
278+
item_ids.add(item_id)
279+
280+
# Categorize pending items
281+
high_priority = [
282+
item for item in all_pending_items if item.get("priority") == "high"
283+
]
284+
pending_projects = [
285+
item for item in all_pending_items if item.get("type") == "project"
286+
]
287+
pending_tasks = [
288+
item for item in all_pending_items if item.get("type") != "project"
289+
]
290+
291+
# Calculate metrics
292+
total_due = len(due_items)
293+
total_scheduled = len(today_items)
294+
total_completed = len(today_completed)
295+
total_pending = len(all_pending_items)
296+
297+
# Generate planning suggestions
298+
heavy_day_threshold = 5
299+
suggestions = []
300+
if total_due > 0:
301+
suggestions.append(f"Focus on {total_due} overdue items first")
302+
if total_scheduled > heavy_day_threshold:
303+
suggestions.append("Consider rescheduling some tasks - you have a heavy day")
304+
if total_scheduled == 0 and total_due == 0:
305+
suggestions.append("Great! No urgent tasks today - time to work on your goals")
306+
if total_completed > 0:
307+
suggestions.append(
308+
f"Good progress! You've completed {total_completed} items today"
309+
)
310+
311+
# Productivity insights
312+
productivity_note = (
313+
f"You've completed {total_completed} items today!"
314+
if total_completed > 0
315+
else "No completed items yet today - keep going!"
316+
)
317+
318+
return {
319+
# Date and overview
320+
"date": today,
321+
"total_focus_items": total_pending + total_completed,
322+
# Task breakdown
323+
"pending_items": total_pending,
324+
"completed_today": total_completed,
325+
"overdue_items": total_due,
326+
"scheduled_today": total_scheduled,
327+
# Detailed task lists
328+
"tasks": pending_tasks,
329+
"projects": pending_projects,
330+
"high_priority_items": high_priority,
331+
"completed_items": today_completed,
332+
"due_items": due_items[:5], # Show first 5 due items
333+
"today_items": today_items[:5], # Show first 5 scheduled items
334+
"all_pending_items": all_pending_items,
335+
# Context and insights
336+
"active_projects": len(projects),
337+
"active_goals": len(goals),
338+
"goals": goals,
339+
"suggestions": suggestions,
340+
"productivity_note": productivity_note,
341+
"quick_summary": f"{total_due} due, {total_scheduled} scheduled, {total_completed} completed",
342+
# Efficiency metrics
343+
"api_calls_made": 5,
344+
"efficiency_note": "Consolidated view using 5 API calls instead of 11 separate calls",
345+
}
346+
347+
253348
def _calculate_statistics(range_summary: dict[str, Any]) -> None:
254349
"""Calculate statistics from collected data and update range_summary."""
255350
if range_summary["daily_breakdown"]:

0 commit comments

Comments
 (0)