list_summaries
Retrieve previously generated weekly summaries from your productivity data, with options to filter by format, sort order, and limit results.
Instructions
List previously generated weekly summaries from the summaries directory.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of summaries to return (default: 10) | |
| sort | No | Sort order (default: newest) | newest |
| format | No | Filter by format (default: all) | all |
Implementation Reference
- src/tools/list-summaries.js:14-66 (handler)Core implementation of the list_summaries tool handler. Lists summary files from the summaries directory, extracts metadata including date ranges, formats, and generates previews.export async function listSummaries(args) { try { const limit = args.limit || 10; const sort = args.sort || 'newest'; const format = args.format || 'all'; // Get file list const files = await listSummaryFiles({ format, sort, limit }); // Build summary list with metadata const summaries = files.map(file => { const dateRange = parseDateRangeFromFilename(file.filename); const fileFormat = file.filename.endsWith('.html') ? 'html' : 'markdown'; // Extract preview (would need to read file for actual preview) const preview = dateRange ? `Summary for ${formatDisplayDate(dateRange.startDate)} to ${formatDisplayDate(dateRange.endDate)}` : 'Weekly summary'; return { filename: file.filename, path: file.path, format: fileFormat, period: dateRange ? { start: dateRange.startDate, end: dateRange.endDate, days: Math.ceil((new Date(dateRange.endDate) - new Date(dateRange.startDate)) / (1000 * 60 * 60 * 24)), } : null, created: file.created.toISOString(), size_bytes: file.size, preview, }; }); return { success: true, summaries, total_count: summaries.length, filters: { format, sort, limit, }, }; } catch (error) { throw { code: 'LIST_FAILED', message: 'Failed to list summaries', details: error.message, }; } }
- src/tools/index.js:91-117 (schema)Input schema and metadata definition for the list_summaries tool, including parameters for limit, sort, and format.name: 'list_summaries', description: 'List previously generated weekly summaries from the summaries directory.', inputSchema: { type: 'object', properties: { limit: { type: 'integer', description: 'Maximum number of summaries to return (default: 10)', default: 10, minimum: 1, maximum: 100, }, sort: { type: 'string', enum: ['newest', 'oldest'], description: 'Sort order (default: newest)', default: 'newest', }, format: { type: 'string', enum: ['all', 'html', 'markdown'], description: 'Filter by format (default: all)', default: 'all', }, }, }, },
- src/tools/handler.js:31-33 (registration)Registration and dispatching of the list_summaries tool in the central tool handler switch statement.case 'list_summaries': result = await listSummaries(args); break;