Skip to main content
Glama

history_get

Retrieve detailed records of specific AI collaboration sessions to review task distribution, expert assignments, and workflow outcomes for analysis and optimization.

Instructions

获取某次协作的详细记录

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes协作记录 ID

Implementation Reference

  • The main handler for the 'history_get' tool in the MCP CallToolRequestSchema switch statement. It extracts the 'id' parameter, fetches the history entry via HistoryManager.get(id), checks if it exists, and returns a formatted text response using HistoryManager.formatEntry(entry).
    case 'history_get': { const { id } = args as { id: string }; const entry = historyManager.get(id); if (!entry) { throw new Error(`History entry ${id} not found`); } return { content: [ { type: 'text', text: historyManager.formatEntry(entry), }, ], }; }
  • The tool schema and registration definition in the ListToolsRequestSchema handler's tools array. Defines the name, description, and input schema requiring a string 'id'.
    { name: 'history_get', description: '获取某次协作的详细记录', inputSchema: { type: 'object', properties: { id: { type: 'string', description: '协作记录 ID', }, }, required: ['id'], }, },
  • Core logic of retrieving a history entry by ID in HistoryManager.get(). Reads and parses the JSON file from the history directory.
    get(id: string): HistoryEntry | null { const filePath = join(this.historyDir, `${id}.json`); if (!existsSync(filePath)) { return null; } try { const content = readFileSync(filePath, 'utf-8'); return JSON.parse(content) as HistoryEntry; } catch { return null; } }
  • Helper method HistoryManager.formatEntry() that formats the full history entry into a Markdown string for the tool response.
    formatEntry(entry: HistoryEntry): string { const lines = [ `## 📋 任务: ${entry.task}`, `**时间**: ${new Date(entry.timestamp).toLocaleString()}`, `**ID**: ${entry.id}`, `**参与专家**: ${entry.experts.join(', ')}`, '', '### 总结', entry.summary, '', ]; for (const output of entry.outputs) { lines.push(`### 👤 ${output.expertName}`, output.content, ''); } return lines.join('\n'); }
  • src/server.ts:120-403 (registration)
    The ListToolsRequestSchema handler where all tools including 'history_get' are registered by returning the tools array.
    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'], }, }, ], }));

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/7836246/claude-team-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server