Skip to main content
Glama

get_session_history

Retrieve a list of recent coding sessions and their associated commits to track changes and review development progress.

Instructions

Get history of all coding sessions and their commits

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of sessions to return

Implementation Reference

  • The getSessionHistory method in GitService - the actual implementation that executes the tool logic. It runs 'git log --oneline --grep=[AI]' and formats the results.
    async getSessionHistory(limit?: number): Promise<ToolResult> {
      try {
        const logResult = await this.gitCommand(['log', '--oneline', '--grep=[AI]', ...(limit ? [`-${limit}`] : [])]);
        
        if (logResult.isError || !logResult.content[0]) {
          return {
            isError: true,
            content: [{
              type: 'text',
              text: 'No session history available (not a git repository or no AI commits found)'
            }]
          };
        }
    
        const commits = logResult.content[0]?.text?.trim() || '';
        if (!commits) {
          return {
            content: [{
              type: 'text',
              text: 'No AI session commits found'
            }]
          };
        }
    
        const commitLines = commits.split('\n');
        let sessionText = `AI Session History (${commitLines.length} commits):\n\n`;
        
        commitLines.forEach((line, index) => {
          const [hash, ...messageParts] = line.split(' ');
          const message = messageParts.join(' ');
          sessionText += `${index + 1}. ${hash}: ${message}\n`;
        });
    
        return {
          content: [{
            type: 'text',
            text: sessionText
          }]
        };
    
      } catch (error) {
        return {
          isError: true,
          content: [{
            type: 'text',
            text: `Failed to get session history: ${error}`
          }]
        };
      }
    }
  • First schema definition for 'get_session_history' (no parameters). Listed under 'Session Management' tools.
    {
      name: 'get_session_history',
      description: 'Get history of commits in current session',
      inputSchema: {
        type: 'object',
        properties: {}
      }
    },
  • Second schema definition for 'get_session_history' (with optional 'limit' parameter). Listed under 'Enhanced Session Management' tools.
    {
      name: 'get_session_history',
      description: 'Get history of all coding sessions and their commits',
      inputSchema: {
        type: 'object',
        properties: {
          limit: { type: 'number', description: 'Maximum number of sessions to return' }
        }
      }
    },
  • src/index.ts:324-325 (registration)
    Registration case in the tool dispatcher (line 324-325) for 'get_session_history' with args.limit - routes to gitService.getSessionHistory(args.limit).
    case 'get_session_history':
      return await this.gitService.getSessionHistory(args.limit);
  • src/index.ts:361-362 (registration)
    Second registration case in the tool dispatcher (line 361-362) for 'get_session_history' without args - routes to gitService.getSessionHistory().
    case 'get_session_history':
      return await this.gitService.getSessionHistory();
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of disclosing behavior. It indicates a read-only operation ('Get history') and implies the return of session and commit data, but does not detail ordering, pagination, or default limits for the 'limit' parameter.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that communicates the tool's purpose without any extraneous text. It is front-loaded and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple list tool with one optional parameter and no output schema, the description adequately conveys what the tool does. It could be improved by specifying ordering or the structure of the returned data, but it is largely sufficient.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema already provides a full description for the only parameter 'limit' ('Maximum number of sessions to return'), so the description adds no additional meaning. Per criteria, 100% schema coverage gives a baseline of 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool retrieves the history of all coding sessions and their commits, with a specific verb and resource. It distinguishes itself from siblings like get_current_session and get_session_info by explicitly mentioning 'all coding sessions'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not provide any guidance on when to use this tool versus alternatives. There is no mention of typical use cases, prerequisites, or when not to use it, leaving the agent to infer from context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/agentics-ai/code-mcp'

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