Skip to main content
Glama

history_context

Retrieve recent collaboration context to continue previous work by accessing the last few interactions between AI models.

Instructions

获取最近的协作上下文,可用于继续之前的工作

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNo获取最近几次协作,默认 3

Implementation Reference

  • src/server.ts:246-258 (registration)
    Tool registration in ListToolsRequestSchema handler, defining name, description, and input schema for 'history_context' tool.
    {
      name: 'history_context',
      description: '获取最近的协作上下文,可用于继续之前的工作',
      inputSchema: {
        type: 'object',
        properties: {
          count: {
            type: 'number',
            description: '获取最近几次协作,默认 3',
          },
        },
      },
    },
  • The main handler for the 'history_context' tool in the CallToolRequestSchema switch statement. It calls historyManager.getRecent to fetch recent collaboration history and formats it as markdown context for continuing previous work.
    case 'history_context': {
      const { count } = args as { count?: number };
      const recent = historyManager.getRecent(count || 3);
      if (recent.length === 0) {
        return {
          content: [
            {
              type: 'text',
              text: '暂无协作历史记录',
            },
          ],
        };
      }
    
      const contextText = recent.map(entry => {
        return `### ${entry.task}\n**ID**: ${entry.id}\n**时间**: ${new Date(entry.timestamp).toLocaleString()}\n\n${entry.summary}`;
      }).join('\n\n---\n\n');
    
      return {
        content: [
          {
            type: 'text',
            text: `## 📚 最近的协作上下文\n\n${contextText}`,
          },
        ],
      };
    }
  • HistoryManager.getRecent method, which retrieves the most recent complete history entries by calling list() and get() methods. This is the core utility function invoked by the tool handler.
     */
    getRecent(count = 5): HistoryEntry[] {
      return this.list(count)
        .map((s) => this.get(s.id))
        .filter((e): e is HistoryEntry => e !== null);
    }

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