sun_list_summaries
Retrieve all saved conversation summaries from the Sun MCP Server to review key insights, outcomes, and next steps from previous chat sessions.
Instructions
List all saved session summaries
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/server.ts:180-217 (handler)Main handler for 'sun_list_summaries' tool. Retrieves summaries from fileManager, handles empty list, formats a numbered list with creation date, functionality, and status, returns formatted Markdown text response.private async handleListSummaries() { const summaries = await this.fileManager.listSummaries(); if (summaries.length === 0) { return { content: [ { type: 'text', text: '📂 暂无保存的会话总结\n\n使用 `-sun` 命令创建第一个会话总结!', }, ], }; } const summaryList = summaries .map((file, index) => { const date = new Date(file.createdAt).toLocaleString('zh-CN'); return `${index + 1}. **${file.filename}** 📅 创建时间: ${date} 🎯 功能: ${file.summary.functionality} 📊 状态: ${file.summary.completionStatus}`; }) .join('\n\n'); return { content: [ { type: 'text', text: `📂 **已保存的会话总结** (${summaries.length}个) ${summaryList} --- 使用 \`sun_get_summary\` 获取特定总结的详细内容`, }, ], }; }
- src/server.ts:72-79 (registration)Registration of the 'sun_list_summaries' tool in the ListToolsRequestSchema handler, including name, description, and empty input schema (no parameters required).{ name: 'sun_list_summaries', description: 'List all saved session summaries', inputSchema: { type: 'object', properties: {}, }, },
- src/server.ts:75-78 (schema)Input schema for the 'sun_list_summaries' tool, defining an empty object (no input parameters required).inputSchema: { type: 'object', properties: {}, },
- src/fileManager.ts:139-176 (helper)Supporting helper method in FileManager that lists all .mdc files in the .sun directory, parses each file's summary metadata using parseSummaryFromMarkdown, collects into SavedSummaryFile objects, sorts by newest first, and returns the array.async listSummaries(): Promise<SavedSummaryFile[]> { await this.ensureSunDirectory(); try { const files = await fs.readdir(this.sunDir); const mdcFiles = files.filter(file => file.endsWith('.mdc')); const summaries: SavedSummaryFile[] = []; for (const filename of mdcFiles) { const filePath = path.join(this.sunDir, filename); const stats = await fs.stat(filePath); // Try to parse the summary from the file try { const content = await fs.readFile(filePath, 'utf-8'); const summary = this.parseSummaryFromMarkdown(content, filename); summaries.push({ filename, path: filePath, summary, createdAt: stats.birthtime.toISOString() }); } catch (parseError) { console.warn(`Failed to parse summary from ${filename}:`, parseError); } } // Sort by creation time (newest first) return summaries.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() ); } catch (error) { console.error('Failed to list summaries:', error); throw error; } }