sync_pull
Pull and synchronize data from GitHub repositories to update remote memory storage for collaborative knowledge graph management.
Instructions
GitHub에서 데이터를 가져와 동기화합니다
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:668-680 (handler)The handleSyncPull method that executes the 'sync_pull' tool by calling syncManager.pullFromRemote() to pull latest data from GitHub and returns a formatted JSON response.private async handleSyncPull(args: any) { const result = await this.syncManager.pullFromRemote(); return { content: [{ type: 'text', text: JSON.stringify({ operation: 'sync_pull', ...result, }, null, 2), }], }; }
- src/index.ts:317-324 (registration)Registration of the 'sync_pull' tool in the ListTools response, defining name, description, and input schema (no required parameters).{ name: 'sync_pull', description: 'GitHub에서 데이터를 가져와 동기화합니다', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:320-323 (schema)Input schema for the 'sync_pull' tool, which accepts an empty object (no parameters required).inputSchema: { type: 'object', properties: {}, },
- src/sync-manager.ts:23-67 (helper)Supporting method pullFromRemote in SyncManager that performs the actual GitHub file fetch, conflict resolution, and memory update logic used by the sync_pull handler.async pullFromRemote(): Promise<SyncResult> { try { const remoteFile = await this.githubClient.getFile(this.MEMORY_FILE_PATH); if (remoteFile) { const remoteData = JSON.parse(remoteFile.content); const localGraph = this.memoryManager.getGraph(); // 충돌 감지 및 해결 const conflictResolved = await this.resolveConflicts(localGraph, remoteData); // 원격 데이터로 로컬 업데이트 this.memoryManager.fromJSON(remoteData); this.isInitialLoad = false; // 초기 로드 완료 표시 return { success: true, conflictResolved, lastSync: new Date().toISOString(), }; } else { // 원격에 파일이 없고 초기 로드가 아닐 때만 푸시 if (!this.isInitialLoad) { return await this.pushToRemote(); } else { // 초기 로드 시에는 빈 상태로 시작 this.isInitialLoad = false; return { success: true, conflictResolved: false, lastSync: new Date().toISOString(), }; } } } catch (error) { this.isInitialLoad = false; return { success: false, conflictResolved: false, lastSync: new Date().toISOString(), error: error instanceof Error ? error.message : 'Unknown error', }; } }