Skip to main content
Glama

sync_context_files

Sync context files for AI assistants during work sessions to maintain updated information without interrupting your workflow.

Instructions

Sync all context files (claude.md, gemini.md, agents.md, .cursor/context.md) without closing the session. Useful for mid-session syncs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Core handler function that implements the logic to sync context files by reading Agent OS context, generating unified context including project overview, status, recent work, etc., and writing it to claude.md, gemini.md, agents.md, and .cursor/context.md.
    private async syncContextFiles(summary: SessionSummary): Promise<string[]> { const contextFiles = ['claude.md', 'gemini.md', 'agents.md', '.cursor/context.md']; const updatedFiles: string[] = []; // Read Agent OS context if available const agentOSContext = await this.getAgentOSContext(); // Generate unified context const unifiedContext = this.generateUnifiedContext(agentOSContext, summary); // Update each context file for (const file of contextFiles) { const filePath = path.join(this.projectRoot, file); // Skip if file doesn't exist and isn't required if (!await this.fileExists(filePath) && file !== '.cursor/context.md') { continue; } // Ensure directory exists await fs.mkdir(path.dirname(filePath), { recursive: true }); await fs.writeFile(filePath, unifiedContext, 'utf-8'); updatedFiles.push(file); } return updatedFiles; }
  • MCP server request handler for the 'sync_context_files' tool call, which creates a minimal session summary and delegates to the SessionCloser.syncContextFiles method.
    case 'sync_context_files': { // Create a minimal summary for syncing const summary = { timestamp: new Date().toISOString(), accomplishments: ['Context files synced'], decisions: [], blockers: [], nextSteps: [], filesChanged: [], }; // Access private method via type assertion const filesUpdated = await (this.sessionCloser as any).syncContextFiles(summary); return { content: [ { type: 'text', text: JSON.stringify({ success: true, filesUpdated, message: 'Context files synced successfully!', }, null, 2), }, ], }; }
  • src/index.ts:77-84 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining the tool name, description, and input schema (empty object).
    { name: 'sync_context_files', description: 'Sync all context files (claude.md, gemini.md, agents.md, .cursor/context.md) without closing the session. Useful for mid-session syncs.', inputSchema: { type: 'object', properties: {}, }, },

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