get_summary
Retrieve weekly productivity summaries by filename or date range from Slack, Google Calendar, and Gmail activity analysis.
Instructions
Retrieve a specific weekly summary by filename or date range.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filename | No | Filename of the summary to retrieve | |
| start_date | No | Start date to find summary (YYYY-MM-DD) | |
| end_date | No | End date to find summary (YYYY-MM-DD) | |
| format | No | Format to retrieve (default: both) | both |
| include_content | No | Include full content or just metadata (default: true) |
Implementation Reference
- src/tools/get-summary.js:14-120 (handler)The main handler function that executes the get_summary tool logic: resolves filename from args or dates, checks existence, extracts metadata, and optionally includes content in requested format.export async function getSummary(args) { try { let filename = args.filename; const format = args.format || 'both'; const includeContent = args.include_content !== false; // If no filename provided, try to construct from date range if (!filename && args.start_date && args.end_date) { // Try HTML first, then markdown const htmlFilename = generateFilename(args.start_date, args.end_date, 'html'); const mdFilename = generateFilename(args.start_date, args.end_date, 'markdown'); if (fileExists(htmlFilename)) { filename = htmlFilename; } else if (fileExists(mdFilename)) { filename = mdFilename; } else { throw { code: 'FILE_NOT_FOUND', message: 'No summary found for the specified date range', details: `Looked for: ${htmlFilename} and ${mdFilename}`, }; } } if (!filename) { throw { code: 'MISSING_PARAMETER', message: 'Either filename or start_date/end_date must be provided', }; } // Check if file exists if (!fileExists(filename)) { throw { code: 'FILE_NOT_FOUND', message: `Summary not found: ${filename}`, details: 'Use list_summaries to see available summaries', }; } // Parse metadata from filename const dateRange = parseDateRangeFromFilename(filename); const fileFormat = filename.endsWith('.html') ? 'html' : 'markdown'; const size = await getFileSize(filename); const result = { success: true, summary: { filename, format: fileFormat, period: dateRange ? { start: dateRange.startDate, end: dateRange.endDate, display: `${formatDisplayDate(dateRange.startDate)} to ${formatDisplayDate(dateRange.endDate)}`, } : null, size_bytes: size, }, }; // Include content if requested if (includeContent) { const content = await readSummary(filename); if (format === 'both') { // Try to read both formats if (fileFormat === 'html') { result.summary.html_content = content; // Try to find markdown version const mdFilename = filename.replace('.html', '.md'); if (fileExists(mdFilename)) { result.summary.markdown_content = await readSummary(mdFilename); } } else { result.summary.markdown_content = content; // Try to find HTML version const htmlFilename = filename.replace('.md', '.html'); if (fileExists(htmlFilename)) { result.summary.html_content = await readSummary(htmlFilename); } } } else if (format === fileFormat) { result.summary.content = content; } else { throw { code: 'FORMAT_MISMATCH', message: `Requested format '${format}' but file is '${fileFormat}'`, details: `Try requesting format: '${fileFormat}' or 'both'`, }; } } return result; } catch (error) { if (error.code) { throw error; } throw { code: 'GET_FAILED', message: 'Failed to retrieve summary', details: error.message, }; } }
- src/tools/index.js:118-151 (schema)JSON input schema for the get_summary tool, defining parameters, types, descriptions, and defaults.{ name: 'get_summary', description: 'Retrieve a specific weekly summary by filename or date range.', inputSchema: { type: 'object', properties: { filename: { type: 'string', description: 'Filename of the summary to retrieve', }, start_date: { type: 'string', description: 'Start date to find summary (YYYY-MM-DD)', pattern: '^\\d{4}-\\d{2}-\\d{2}$', }, end_date: { type: 'string', description: 'End date to find summary (YYYY-MM-DD)', pattern: '^\\d{4}-\\d{2}-\\d{2}$', }, format: { type: 'string', enum: ['html', 'markdown', 'both'], description: 'Format to retrieve (default: both)', default: 'both', }, include_content: { type: 'boolean', description: 'Include full content or just metadata (default: true)', default: true, }, }, }, },
- src/tools/handler.js:9-37 (registration)Import and dispatch case in the central tool handler that registers and routes calls to the getSummary implementation.import { getSummary } from './get-summary.js'; import { getQuickStats } from './quick-stats.js'; import { comparePeriods } from './compare-periods.js'; /** * Handle a tool call by routing to the appropriate handler * @param {string} name - Tool name * @param {object} args - Tool arguments * @returns {Promise<string>} Tool result as JSON string */ export async function handleToolCall(name, args) { let result; switch (name) { case 'generate_daily_summary': result = await generateDailySummary(args); break; case 'generate_weekly_summary': result = await generateWeeklySummary(args); break; case 'list_summaries': result = await listSummaries(args); break; case 'get_summary': result = await getSummary(args); break;