continue_conversation
Extend ongoing code analysis conversations by providing session ID and follow-up message. Enable inclusion of code snippets for detailed responses. Integrates Claude Code and Google's Gemini AI for comprehensive debugging and long-trace analysis.
Instructions
Continue an ongoing analysis conversation
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_code_snippets | No | Whether to include code snippets in response | |
| message | Yes | Claude's response or follow-up question | |
| session_id | Yes | ID of the conversation session |
Implementation Reference
- src/index.ts:679-695 (handler)Top-level MCP tool handler for 'continue_conversation' that validates input and delegates to DeepCodeReasonerV2.continueConversation.case 'continue_conversation': { const parsed = ContinueConversationSchema.parse(args); const result = await deepReasoner.continueConversation( parsed.session_id, parsed.message, parsed.include_code_snippets, ); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/index.ts:112-116 (schema)Zod input schema validation for the continue_conversation tool parameters.const ContinueConversationSchema = z.object({ session_id: z.string(), message: z.string(), include_code_snippets: z.boolean().optional(), });
- src/index.ts:362-383 (registration)Registration of the continue_conversation tool in the MCP server's tools list with description and input schema.{ name: 'continue_conversation', description: 'Continue an ongoing analysis conversation', inputSchema: { type: 'object', properties: { session_id: { type: 'string', description: 'ID of the conversation session', }, message: { type: 'string', description: 'Claude\'s response or follow-up question', }, include_code_snippets: { type: 'boolean', description: 'Whether to include code snippets in response', }, }, required: ['session_id', 'message'], }, },
- Handler in DeepCodeReasonerV2 managing session locking, history tracking, and delegating to ConversationalGeminiService.continueConversation.async continueConversation( sessionId: string, message: string, includeCodeSnippets?: boolean, ): Promise<{ response: string; analysisProgress: number; canFinalize: boolean; status: string; }> { // Acquire lock before processing const lockAcquired = this.conversationManager.acquireLock(sessionId); if (!lockAcquired) { throw new ConversationLockedError(sessionId); } try { // Validate session const session = this.conversationManager.getSession(sessionId); if (!session) { throw new SessionNotFoundError(sessionId); } // Add Claude's message to conversation history this.conversationManager.addTurn(sessionId, 'claude', message); // Continue with Gemini const { response, analysisProgress, canFinalize } = await this.conversationalGemini.continueConversation( sessionId, message, includeCodeSnippets, ); // Track Gemini's response this.conversationManager.addTurn(sessionId, 'gemini', response); // Update progress this.conversationManager.updateProgress(sessionId, { confidenceLevel: analysisProgress, }); return { response, analysisProgress, canFinalize, status: session.status, }; } catch (error) { console.error('Failed to continue conversation:', error); throw error; } finally { // Always release lock this.conversationManager.releaseLock(sessionId); } }
- Core handler implementing the Gemini API call for continuing the conversation, including prompt sanitization and response processing.async continueConversation( sessionId: string, message: string, includeCodeSnippets?: boolean, ): Promise<{ response: string; analysisProgress: number; canFinalize: boolean }> { const chat = this.activeSessions.get(sessionId); const context = this.sessionContexts.get(sessionId); if (!chat || !context) { throw new SessionNotFoundError(sessionId); } // Sanitize the incoming message const sanitizedMessage = PromptSanitizer.sanitizeString(message); // Check for potential injection attempts if (PromptSanitizer.containsInjectionAttempt(message)) { console.warn(`Potential injection attempt in session ${sessionId}:`, message.substring(0, 100)); } // Process Claude's message with safety wrapper let processedMessage = `REMINDER: The following is a message from Claude in our ongoing analysis conversation. Focus on the technical analysis task. <CLAUDE_MESSAGE> ${sanitizedMessage} </CLAUDE_MESSAGE>`; if (includeCodeSnippets && this.hasCodeReference(message)) { const enrichedContent = this.enrichMessageWithCode(sanitizedMessage, context.codeFiles); processedMessage += `\n\n${enrichedContent}`; } // Send message to Gemini const result = await chat.sendMessage(processedMessage); const response = result.response.text(); // Calculate analysis progress const progress = this.calculateProgress(chat, context); const canFinalize = progress >= 0.8; return { response, analysisProgress: progress, canFinalize, }; }