get_quick_stats
Retrieve productivity metrics from Slack, Calendar, and Gmail without generating full summaries. Use this tool to analyze activity data quickly with customizable date ranges.
Instructions
Get quick productivity metrics (Slack, Calendar, Gmail) without generating a full summary. Fast lightweight query.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| days_back | No | Number of days to analyze (default: 7) | |
| start_date | No | Optional start date in YYYY-MM-DD format | |
| end_date | No | Optional end date in YYYY-MM-DD format |
Implementation Reference
- src/tools/quick-stats.js:16-78 (handler)The main execution function for the 'get_quick_stats' tool. Calculates date range, generates lightweight data collection instructions for Slack, Calendar, and Gmail, processes optional stats data, and returns structured results.export async function getQuickStats(args) { const startTime = Date.now(); try { // Calculate date range const { startDate, endDate, days } = calculateDateRange(args); // Generate lightweight data collection instructions const instructions = ` # Quick Stats Data Collection Collect basic metrics for **${startDate} to ${endDate}** (${days} days): ## Slack Metrics Use mcp_playground-slack-mcp_slack_my_messages: - Count total messages - List top 5 channels by activity - Count threads participated in ## Calendar Metrics Use mcp_gworkspace-mcp_calendar_events: - Count total events - Calculate total meeting hours - Identify longest meeting ## Gmail Metrics Use mcp_gworkspace-mcp_read_mail (lightweight - no body): - Count emails sent (from:me) - Count emails received - List top 3 email contacts Return raw counts and lists only - no deep analysis needed. `; const result = { success: true, message: 'Quick stats collection initiated. Follow instructions to gather lightweight metrics.', period: { start: startDate, end: endDate, days, }, instructions, note: 'This tool provides a faster alternative to full summary generation. Collect basic metrics only without detailed analysis.', }; // If stats data is provided, structure it if (args.stats_data) { result.stats = processStatsData(args.stats_data); } result.generation_time_ms = Date.now() - startTime; return result; } catch (error) { throw { code: error.code || 'STATS_FAILED', message: error.message || 'Failed to get quick stats', details: error.details || error.stack, }; } }
- src/tools/index.js:152-177 (schema)JSON schema definition for the 'get_quick_stats' tool inputs, including parameters for date range specification.{ name: 'get_quick_stats', description: 'Get quick productivity metrics (Slack, Calendar, Gmail) without generating a full summary. Fast lightweight query.', inputSchema: { type: 'object', properties: { days_back: { type: 'integer', description: 'Number of days to analyze (default: 7)', default: 7, minimum: 1, maximum: 90, }, start_date: { type: 'string', description: 'Optional start date in YYYY-MM-DD format', pattern: '^\\d{4}-\\d{2}-\\d{2}$', }, end_date: { type: 'string', description: 'Optional end date in YYYY-MM-DD format', pattern: '^\\d{4}-\\d{2}-\\d{2}$', }, }, }, },
- src/tools/handler.js:39-41 (registration)Tool dispatch registration in the main handler switch statement, routing 'get_quick_stats' calls to the getQuickStats implementation.case 'get_quick_stats': result = await getQuickStats(args); break;
- src/tools/quick-stats.js:83-106 (helper)Helper function to structure and normalize collected stats data from Slack, Calendar, and Email into a consistent format.function processStatsData(data) { return { slack: { total_messages: data.slack?.total_messages || 0, top_channels: data.slack?.top_channels || [], threads_participated: data.slack?.threads_participated || 0, reactions_given: data.slack?.reactions_given || 0, reactions_received: data.slack?.reactions_received || 0, }, calendar: { total_events: data.calendar?.total_events || 0, total_meeting_hours: data.calendar?.total_meeting_hours || 0, average_daily_meetings: data.calendar?.average_daily_meetings || 0, longest_meeting_hours: data.calendar?.longest_meeting_hours || 0, focus_time_hours: data.calendar?.focus_time_hours || 0, }, email: { total_emails: data.email?.total_emails || 0, emails_sent: data.email?.emails_sent || 0, emails_received: data.email?.emails_received || 0, top_contacts: data.email?.top_contacts || [], }, }; }
- src/tools/handler.js:10-10 (registration)Import statement registering the getQuickStats handler function for use in the main tool dispatcher.import { getQuickStats } from './quick-stats.js';