Skip to main content
Glama

end_session

Close Cursor work sessions by syncing context files, updating Agent OS files, and committing changes to git with session summaries and accomplishments.

Instructions

Close the current Cursor session, sync all context files, update Agent OS files, and commit to git. This is the main tool for ending a work session.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
conversationSummaryYesSummary of what was accomplished in this session. If not provided, will attempt to extract from context.
accomplishmentsNoList of specific accomplishments (optional, will be extracted if not provided)
decisionsNoList of decisions made during this session (optional)
blockersNoList of blockers or issues encountered (optional)
nextStepsNoList of next steps or TODO items (optional)

Implementation Reference

  • src/index.ts:43-77 (registration)
    Registration of the 'end_session' tool in the ListToolsRequestSchema handler, including name, description, and input schema.
    { name: 'end_session', description: 'Close the current Cursor session, sync all context files, update Agent OS files, and commit to git. This is the main tool for ending a work session.', inputSchema: { type: 'object', properties: { conversationSummary: { type: 'string', description: 'Summary of what was accomplished in this session. If not provided, will attempt to extract from context.', }, accomplishments: { type: 'array', items: { type: 'string' }, description: 'List of specific accomplishments (optional, will be extracted if not provided)', }, decisions: { type: 'array', items: { type: 'string' }, description: 'List of decisions made during this session (optional)', }, blockers: { type: 'array', items: { type: 'string' }, description: 'List of blockers or issues encountered (optional)', }, nextSteps: { type: 'array', items: { type: 'string' }, description: 'List of next steps or TODO items (optional)', }, }, required: ['conversationSummary'], }, }, {
  • Input schema for the end_session tool defining parameters like conversationSummary (required) and optional arrays.
    inputSchema: { type: 'object', properties: { conversationSummary: { type: 'string', description: 'Summary of what was accomplished in this session. If not provided, will attempt to extract from context.', }, accomplishments: { type: 'array', items: { type: 'string' }, description: 'List of specific accomplishments (optional, will be extracted if not provided)', }, decisions: { type: 'array', items: { type: 'string' }, description: 'List of decisions made during this session (optional)', }, blockers: { type: 'array', items: { type: 'string' }, description: 'List of blockers or issues encountered (optional)', }, nextSteps: { type: 'array', items: { type: 'string' }, description: 'List of next steps or TODO items (optional)', }, }, required: ['conversationSummary'], },
  • MCP CallToolRequestSchema handler implementation for end_session: extracts conversationSummary from args, calls SessionCloser.closeSession, and returns formatted JSON result.
    case 'end_session': { const conversationSummary = args.conversationSummary as string || 'Session work completed. Review conversation history for details.'; const result = await this.sessionCloser.closeSession(conversationSummary); return { content: [ { type: 'text', text: JSON.stringify({ success: result.success, summary: result.summary, filesUpdated: result.filesUpdated, gitCommit: result.gitCommit, message: 'Session closed successfully! All context files synced and changes committed.', }, null, 2), }, ], }; }
  • Core helper function SessionCloser.closeSession implementing the full session closing logic: summary gathering, file updates, context sync, and git commit.
    /** * Main entry point for closing a session */ async closeSession(conversationSummary: string): Promise<{ success: boolean; summary: SessionSummary; filesUpdated: string[]; gitCommit?: string; }> { const timestamp = new Date().toISOString(); const summary = await this.gatherSessionSummary(conversationSummary, timestamp); const filesUpdated: string[] = []; // 1. Update session summary file await this.updateSessionSummary(summary); filesUpdated.push('.agent-os/session-summary.md'); // 2. Update Agent OS files if they exist const agentOSUpdates = await this.updateAgentOSFiles(summary); filesUpdated.push(...agentOSUpdates); // 3. Sync context files const contextFiles = await this.syncContextFiles(summary); filesUpdated.push(...contextFiles); // 4. Git commit let gitCommit: string | undefined; if (await this.isGitRepo()) { gitCommit = await this.commitChanges(summary, filesUpdated); } return { success: true, summary, filesUpdated, gitCommit }; }

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/Tylarcam/mcp-session-closer'

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