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 MCP tool handler for 'sync_pull'. Delegates to SyncManager.pullFromRemote() and returns formatted result with operation identifier.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)Tool registration in ListToolsResponse, including name, description, and empty input schema.{ name: 'sync_pull', description: 'GitHub에서 데이터를 가져와 동기화합니다', inputSchema: { type: 'object', properties: {}, }, },
- src/index.ts:404-405 (registration)Dispatch routing in CallToolRequest handler switch statement.case 'sync_pull': return await this.handleSyncPull(args);
- src/sync-manager.ts:23-67 (helper)Core helper method implementing the sync pull logic: fetches remote graph.json, resolves conflicts by timestamp, updates local memory, handles initial load and errors.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', }; } }