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
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "get_session_history"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of sessions to return |
Implementation Reference
- src/services/GitService.ts:843-892 (handler)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}` }] }; } } - src/toolDefinitions.ts:759-766 (schema)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: {} } }, - src/toolDefinitions.ts:1039-1048 (schema)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();