history_list
Retrieve a list of recent team collaboration history records. Optionally specify the number of records to return.
Instructions
查看团队协作历史记录列表
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | 返回记录数量,默认 10 |
Implementation Reference
- src/server.ts:511-522 (handler)Handler/execution block for the 'history_list' tool. It extracts the optional 'limit' parameter, calls historyManager.list() to get summaries, and returns formatted markdown via historyManager.formatList().
case 'history_list': { const { limit } = args as { limit?: number }; const summaries = historyManager.list(limit || 10); return { content: [ { type: 'text', text: historyManager.formatList(summaries), }, ], }; } - src/server.ts:201-213 (schema)Schema/registration of the 'history_list' tool definition in ListToolsRequestSchema. Defines the tool name, description, and input schema (optional 'limit' number parameter).
{ name: 'history_list', description: '查看团队协作历史记录列表', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: '返回记录数量,默认 10', }, }, }, }, - src/collaboration/history.ts:164-194 (helper)The HistoryManager.list() method that reads JSON files from the history directory, sorts them in reverse chronological order, and returns up to 'limit' HistorySummary objects.
list(limit = 20): HistorySummary[] { if (!existsSync(this.historyDir)) { return []; } // 获取并排序文件 const files = readdirSync(this.historyDir) .filter((f) => f.endsWith('.json')) .sort() .reverse() .slice(0, limit); // 读取并解析 return files .map((file) => { try { const content = readFileSync(join(this.historyDir, file), 'utf-8'); const entry = JSON.parse(content) as HistoryEntry; return { id: entry.id, timestamp: entry.timestamp, task: entry.task, summary: entry.summary, experts: entry.experts, }; } catch { return null; } }) .filter((e): e is HistorySummary => e !== null); } - src/collaboration/history.ts:255-279 (helper)The HistoryManager.formatList() method that formats a list of HistorySummary objects into a human-readable Markdown string.
formatList(summaries: readonly HistorySummary[]): string { if (summaries.length === 0) { return '暂无协作历史记录'; } const lines = ['## 📚 协作历史记录\n']; for (const entry of summaries) { const date = new Date(entry.timestamp).toLocaleString(); const taskPreview = entry.task.length > TASK_PREVIEW_MAX_LENGTH ? `${entry.task.slice(0, TASK_PREVIEW_MAX_LENGTH)}...` : entry.task; lines.push( `- **${entry.id}** (${date})`, ` 任务: ${taskPreview}`, ` 专家: ${entry.experts.join(', ')}`, '' ); } lines.push('\n使用 `history_get` 工具查看详情,传入 ID 即可。'); return lines.join('\n'); } - src/server.ts:120-403 (registration)Registration of all tools via ListToolsRequestSchema handler (the 'history_list' tool is registered among the tool list).
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: [ { name: 'team_work', description: '让 AI 开发团队协作完成任务。团队包含前端专家、后端专家、QA专家,会智能分配任务并互相协作。', inputSchema: { type: 'object', properties: { task: { type: 'string', description: '任务描述,例如:帮我写一个用户登录功能', }, context: { type: 'string', description: '额外的上下文信息(可选)', }, }, required: ['task'], }, }, { name: 'ask_expert', description: '向特定专家咨询问题', inputSchema: { type: 'object', properties: { expert: { type: 'string', enum: expertEnumInfo.enum, description: expertEnumInfo.description, }, question: { type: 'string', description: '要咨询的问题', }, }, required: ['expert', 'question'], }, }, { name: 'code_review', description: '让专家审查代码', inputSchema: { type: 'object', properties: { code: { type: 'string', description: '要审查的代码', }, reviewer: { type: 'string', enum: expertEnumInfo.enum, description: `审查者:${expertEnumInfo.description}`, }, context: { type: 'string', description: '代码的背景信息(可选)', }, }, required: ['code', 'reviewer'], }, }, { name: 'fix_bug', description: '让 QA 专家修复 Bug', inputSchema: { type: 'object', properties: { code: { type: 'string', description: '有 Bug 的代码', }, error: { type: 'string', description: '错误信息或 Bug 描述', }, }, required: ['code', 'error'], }, }, { name: 'history_list', description: '查看团队协作历史记录列表', inputSchema: { type: 'object', properties: { limit: { type: 'number', description: '返回记录数量,默认 10', }, }, }, }, { name: 'history_get', description: '获取某次协作的详细记录', inputSchema: { type: 'object', properties: { id: { type: 'string', description: '协作记录 ID', }, }, required: ['id'], }, }, { name: 'history_search', description: '搜索协作历史记录', inputSchema: { type: 'object', properties: { query: { type: 'string', description: '搜索关键词', }, limit: { type: 'number', description: '返回记录数量,默认 10', }, }, required: ['query'], }, }, { name: 'history_context', description: '获取最近的协作上下文,可用于继续之前的工作', inputSchema: { type: 'object', properties: { count: { type: 'number', description: '获取最近几次协作,默认 3', }, }, }, }, { name: 'usage_stats', description: '查看各模型的使用统计(调用次数、成功率、平均耗时)', inputSchema: { type: 'object', properties: {}, }, }, { name: 'team_dashboard', description: '查看团队当前状态:可用专家、模型配置、最近活动', inputSchema: { type: 'object', properties: {}, }, }, { name: 'cost_estimate', description: '预估任务执行成本(Token 用量、预计耗时)', inputSchema: { type: 'object', properties: { task: { type: 'string', description: '要预估的任务描述', }, }, required: ['task'], }, }, { name: 'explain_plan', description: '解释 Tech Lead 会如何分配任务(不实际执行)', inputSchema: { type: 'object', properties: { task: { type: 'string', description: '要分析的任务描述', }, }, required: ['task'], }, }, { name: 'read_project_files', description: '读取项目文件内容,让专家了解代码上下文', inputSchema: { type: 'object', properties: { path: { type: 'string', description: '文件或目录路径(相对于当前工作目录)', }, pattern: { type: 'string', description: '文件匹配模式(如 *.ts, *.js),仅读取目录时有效', }, maxFiles: { type: 'number', description: '最多读取文件数(默认 10)', }, }, required: ['path'], }, }, { name: 'generate_commit_message', description: '根据代码变更生成 Git commit message', inputSchema: { type: 'object', properties: { diff: { type: 'string', description: '代码变更内容(git diff 输出)', }, style: { type: 'string', enum: ['conventional', 'simple', 'detailed'], description: '提交信息风格:conventional(约定式)、simple(简洁)、detailed(详细)', }, }, required: ['diff'], }, }, { name: 'analyze_project_structure', description: '分析项目结构,识别技术栈和架构', inputSchema: { type: 'object', properties: { path: { type: 'string', description: '项目根目录路径(默认当前目录)', }, }, }, }, { name: 'list_workflows', description: '列出所有可用的工作流模板', inputSchema: { type: 'object', properties: {}, }, }, { name: 'run_workflow', description: '使用指定工作流执行任务', inputSchema: { type: 'object', properties: { workflow: { type: 'string', enum: ['code-generation', 'bug-fix', 'refactoring', 'code-review', 'documentation'], description: '工作流 ID', }, task: { type: 'string', description: '任务描述', }, context: { type: 'string', description: '额外上下文(可选)', }, }, required: ['workflow', 'task'], }, }, { name: 'suggest_workflow', description: '根据任务自动推荐合适的工作流', inputSchema: { type: 'object', properties: { task: { type: 'string', description: '任务描述', }, }, required: ['task'], }, }, ], }));