generate_daily_summary
Generate daily productivity summaries by analyzing your Slack messages, Calendar events, and Gmail activity for end-of-day wrap-ups and next-day planning.
Instructions
Generate a concise daily productivity summary from today's Slack, Calendar, and Gmail activity. Perfect for end-of-day wrap-ups and next-day planning.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| date | No | Date to summarize in YYYY-MM-DD format (default: today) | |
| output_format | No | Output format(s) to generate (default: both) | both |
| save_to_file | No | Whether to save output to summaries directory (default: true) | |
| include_sections | No | Sections to include (default: all) |
Implementation Reference
- Core handler function that orchestrates daily summary generation: collects parameters, generates data instructions and template, processes collected data if provided, handles file saving, and returns structured result.export async function generateDailySummary(args) { const startTime = Date.now(); try { // Get the date (default to today) const targetDate = args.date || new Date().toISOString().split('T')[0]; const startDate = targetDate; const endDate = targetDate; const outputFormat = args.output_format || config.defaults.outputFormat; const saveToFile = args.save_to_file !== false; const includeSections = args.include_sections || ['meetings', 'communications', 'accomplishments', 'tomorrow']; // Generate data collection instructions for the AI const instructions = generateDailyDataCollectionInstructions(targetDate); // Generate summary template const summaryTemplate = generateDailySummaryTemplate(targetDate, includeSections); // Prepare response structure const result = { success: true, message: 'Daily summary generation initiated. Please follow the data collection instructions below.', date: targetDate, instructions, template: summaryTemplate, output_format: outputFormat, save_to_file: saveToFile, note: 'This tool provides instructions for the AI agent to collect today\'s data and generate a concise daily summary.', }; // If the AI has already collected data (passed in args), process it if (args.collected_data) { result.summary = await processDailySummaryData(args.collected_data, targetDate, includeSections); // Save to file if requested if (saveToFile) { const files = []; if (outputFormat === 'both' || outputFormat === 'html') { const htmlFilename = `daily-summary-${targetDate}.html`; const htmlPath = await saveSummary(result.summary.html, htmlFilename); files.push(htmlPath); } if (outputFormat === 'both' || outputFormat === 'markdown') { const mdFilename = `daily-summary-${targetDate}.md`; const mdPath = await saveSummary(result.summary.markdown, mdFilename); files.push(mdPath); } result.files_saved = files; } } result.generation_time_ms = Date.now() - startTime; return result; } catch (error) { throw { code: error.code || 'GENERATION_FAILED', message: error.message || 'Failed to generate daily summary', details: error.details || error.stack, }; } }
- src/tools/index.js:12-44 (schema)Input schema definition for the generate_daily_summary tool, including parameters for date, output format, file saving, and sections.{ name: 'generate_daily_summary', description: 'Generate a concise daily productivity summary from today\'s Slack, Calendar, and Gmail activity. Perfect for end-of-day wrap-ups and next-day planning.', inputSchema: { type: 'object', properties: { date: { type: 'string', description: 'Date to summarize in YYYY-MM-DD format (default: today)', pattern: '^\\d{4}-\\d{2}-\\d{2}$', }, output_format: { type: 'string', enum: ['both', 'html', 'markdown', 'json'], description: 'Output format(s) to generate (default: both)', default: 'both', }, save_to_file: { type: 'boolean', description: 'Whether to save output to summaries directory (default: true)', default: true, }, include_sections: { type: 'array', items: { type: 'string', enum: ['meetings', 'communications', 'accomplishments', 'tomorrow'], }, description: 'Sections to include (default: all)', }, }, }, },
- src/tools/handler.js:22-25 (registration)Registration and dispatch logic in the central tool handler: routes 'generate_daily_summary' calls to the specific implementation.switch (name) { case 'generate_daily_summary': result = await generateDailySummary(args); break;
- Helper function that generates detailed data collection instructions for Slack, Calendar, and Gmail specific to the target date.function generateDailyDataCollectionInstructions(date) { return ` # Daily Summary Data Collection To generate a daily productivity summary for **${formatDisplayDate(date)}**, please collect data from the following sources: ${getSlackDataInstructions(date, date)} ${getCalendarDataInstructions(date, date)} ${getGmailDataInstructions(date, date)} ## Daily Summary Focus For daily summaries, focus on: - **Today's key meetings** and outcomes - **Important Slack conversations** and decisions - **Email highlights** - critical communications - **Accomplishments** - what got done today - **Tomorrow's prep** - what's coming up ## Analysis Guidelines - Keep it concise (1-2 minutes to read) - Focus on actionable items and decisions - Highlight what needs follow-up - Note any blockers or concerns - Preview tomorrow's calendar `; }
- Helper function that creates a structured template for the daily summary based on included sections.function generateDailySummaryTemplate(date, sections) { const template = { date: date, display: formatDisplayDate(date), sections: {}, }; if (sections.includes('meetings')) { template.sections.meetings = { total: 0, hours: 0, key_meetings: [], outcomes: [], }; } if (sections.includes('communications')) { template.sections.communications = { slack_messages: 0, important_threads: [], emails: 0, key_contacts: [], }; } if (sections.includes('accomplishments')) { template.sections.accomplishments = [ 'Key accomplishments and completed tasks', ]; } if (sections.includes('tomorrow')) { template.sections.tomorrow = { upcoming_meetings: [], action_items: [], prep_needed: [], }; } return template; }