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)The core handler function `listSummaries` that executes the tool logic: fetches summary files, parses metadata, and returns a structured list.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:90-117 (schema)Tool definition including name, description, and input JSON schema for validation.{ 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 in the central tool dispatcher switch statement, routing calls to the handler.case 'list_summaries': result = await listSummaries(args); break;