Skip to main content
Glama

history_list

Retrieve team collaboration history records to track project progress and review past interactions between AI models.

Instructions

查看团队协作历史记录列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo返回记录数量,默认 10

Implementation Reference

  • MCP CallToolRequestSchema handler for 'history_list' tool. Extracts optional 'limit' parameter, calls historyManager.list(), formats with formatList(), and returns text content.
    case 'history_list': {
      const { limit } = args as { limit?: number };
      const summaries = historyManager.list(limit || 10);
      return {
        content: [
          {
            type: 'text',
            text: historyManager.formatList(summaries),
          },
        ],
      };
    }
  • Tool schema definition including name, description, and inputSchema for 'history_list' in ListTools response.
    {
      name: 'history_list',
      description: '查看团队协作历史记录列表',
      inputSchema: {
        type: 'object',
        properties: {
          limit: {
            type: 'number',
            description: '返回记录数量,默认 10',
          },
        },
      },
    },
  • HistoryManager.list(limit) reads JSON history files from storage directory, parses them into summaries, sorts by recency, limits count, core logic for retrieving history list.
    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);
    }
  • HistoryManager.formatList(summaries) generates Markdown-formatted list of history summaries with previews, dates, tasks, and experts.
    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');
    }

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