think_batch
Submit multiple reasoning thoughts at once to reduce round-trips and process complete reasoning chains efficiently with atomic validation.
Instructions
Submit multiple thoughts at once (Burst Thinking).
Use when you have a complete reasoning chain ready. Reduces N round-trips to 1.
Input:
goal: Session goal (required)
thoughts: Array of 1-30 thoughts
consolidation: Optional {winningPath, summary, verdict}
Validation is atomic - all or nothing.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| goal | Yes | Session goal | |
| thoughts | Yes | Array of thoughts | |
| consolidation | No | Optional consolidation | |
| showTree | No | Show ASCII tree (default: false) |
Implementation Reference
- src/index.ts:175-204 (registration)Registration of the 'think_batch' MCP tool, including inline handler function that delegates to ThinkingService.submitSession and formats the response.server.registerTool('think_batch', { title: 'Think Batch', description: THINK_BATCH_DESCRIPTION, inputSchema: thinkBatchSchema }, async (args) => { try { const result = thinkingService.submitSession({ goal: args.goal as string, thoughts: args.thoughts as BurstThought[], consolidation: args.consolidation as BurstConsolidation | undefined, }); if (result.status === 'rejected') { return { content: [{ type: 'text' as const, text: `π« REJECTED\n${result.validation.errors.map(e => `β’ ${e}`).join('\n')}` }], isError: true }; } // v5.0.1: Compact output - tree only when requested const m = result.metrics; const text = [ 'β ACCEPTED', `π― ${args.goal}`, `π ${result.thoughtsProcessed}t | conf:${m.avgConfidence} ent:${m.avgEntropy} stag:${m.stagnationScore}`, result.validation.warnings.length > 0 ? `β οΈ ${result.validation.warnings.join('; ')}` : '', result.nudge ? `π‘ ${result.nudge}` : '', args.showTree ? result.thoughtTree : '', ].filter(Boolean).join('\n'); return { content: [{ type: 'text' as const, text }] }; } catch (error) { return { content: [{ type: 'text' as const, text: `Error: ${error instanceof Error ? error.message : 'Unknown'}` }], isError: true }; } } );
- src/index.ts:145-173 (schema)Zod input schema for 'think_batch' tool, defining structure for batch thoughts, extensions, and optional consolidation.const burstExtensionSchema = z.object({ type: z.enum(['critique', 'elaboration', 'correction', 'alternative_scenario', 'assumption_testing', 'innovation', 'optimization', 'polish']), content: z.string(), impact: z.enum(['low', 'medium', 'high', 'blocker']).optional(), }); const burstThoughtSchema = z.object({ thoughtNumber: z.number().int().min(1), thought: z.string().min(1), confidence: z.number().min(1).max(10).optional(), subSteps: z.array(z.string()).max(5).optional(), alternatives: z.array(z.string()).max(5).optional(), isRevision: z.boolean().optional(), revisesThought: z.number().int().min(1).optional(), branchFromThought: z.number().int().min(1).optional(), branchId: z.string().optional(), extensions: z.array(burstExtensionSchema).optional(), }); const thinkBatchSchema = { goal: z.string().min(10).describe('Session goal'), thoughts: z.array(burstThoughtSchema).min(1).max(30).describe('Array of thoughts'), consolidation: z.object({ winningPath: z.array(z.number().int().min(1)), summary: z.string(), verdict: z.enum(['ready', 'needs_more_work']), }).optional().describe('Optional consolidation'), showTree: z.boolean().optional().describe('Show ASCII tree (default: false)'), };
- Core handler logic in ThinkingService.submitSession: validates batch input via BurstService, commits thoughts to session history, handles branches, generates metrics/tree/nudges.submitSession(input: SubmitSessionInput): SubmitSessionResult { const { goal, thoughts, consolidation } = input; // Validate using BurstService const validation = this.burstService.validate(goal, thoughts, consolidation); if (!validation.passed || !validation.sortedThoughts) { console.error(`π« Burst session REJECTED: ${validation.errors.length} errors`); return { status: 'rejected', sessionId: '', thoughtsProcessed: 0, validation: { passed: false, errors: validation.errors, warnings: validation.warnings }, metrics: validation.metrics, errorMessage: validation.errors.join('; '), }; } // === Commit Session === this.currentSessionId = new Date().toISOString(); this.sessionGoal = goal; this.reset(); // Convert and add thoughts to history for (const t of validation.sortedThoughts) { const record = this.burstService.toThoughtRecord(t, thoughts.length, this.currentSessionId); this.thoughtHistory.push(record); this.lastThoughtNumber = Math.max(this.lastThoughtNumber, t.thoughtNumber); // Handle branches if (t.branchFromThought && t.branchId) { const branchHistory = this.branches.get(t.branchId) ?? []; branchHistory.push(record); this.branches.set(t.branchId, branchHistory); } } this.invalidateFuseIndex(); // v5.0.1: Async save - don't block response this.saveSession().catch(err => console.error('Failed to save burst session:', err)); // v5.0.1: Minimal system advice - only real issues let systemAdvice: string | undefined; if (validation.warnings.length > 0) { systemAdvice = `β οΈ ${validation.warnings.join('; ')}`; } // v5.0.2: Auto-save insight if consolidation with verdict='ready' if (consolidation?.verdict === 'ready') { this.insightsService.saveWinningPath({ path: consolidation.winningPath, summary: consolidation.summary, goal, avgConfidence: validation.metrics.avgConfidence, sessionLength: thoughts.length, }).catch(err => console.error('Failed to save insight:', err)); systemAdvice = (systemAdvice ? systemAdvice + ' | ' : '') + 'πΎ Insight saved'; } console.error(`β Burst: ${thoughts.length}t, session=${this.currentSessionId.substring(0, 10)}...`); // v4.6.0: Generate nudge for batch (only if no systemAdvice) const hasAlternatives = thoughts.some(t => t.alternatives && t.alternatives.length > 0); const hasBlockers = thoughts.some(t => t.extensions?.some(e => e.impact === 'blocker')); const nudge = !systemAdvice ? this.nudgeService.generateBatchNudge( validation.metrics.avgConfidence, thoughts.length, hasAlternatives, hasBlockers ) : undefined; return { status: 'accepted', sessionId: this.currentSessionId, thoughtsProcessed: thoughts.length, validation: { passed: true, errors: [], warnings: validation.warnings }, metrics: validation.metrics, // v5.0.1: Tree is lazy - generated only when requested via showTree param thoughtTree: this.generateAsciiTree(), systemAdvice, nudge, }; }
- src/types/thought.types.ts:278-339 (schema)TypeScript interfaces defining input/output for think_batch (SubmitSessionInput, BurstThought, SubmitSessionResult).// BURST_LIMITS moved to burst.service.ts to avoid duplication (v4.2.0) /** Single thought in a burst session */ export interface BurstThought { thoughtNumber: number; thought: string; confidence?: number; subSteps?: string[]; alternatives?: string[]; isRevision?: boolean; revisesThought?: number; branchFromThought?: number; branchId?: string; extensions?: QuickExtension[]; } /** Consolidation data for burst session */ export interface BurstConsolidation { winningPath: number[]; summary: string; verdict: ConsolidateVerdict; } /** Input for submit_thinking_session tool */ export interface SubmitSessionInput { /** Session goal - required for burst thinking */ goal: string; /** Array of thoughts (1-30) */ thoughts: BurstThought[]; /** Optional consolidation if ready */ consolidation?: BurstConsolidation; } /** Validation metrics for burst session */ export interface BurstMetrics { avgConfidence: number; avgEntropy: number; avgLength: number; stagnationScore: number; thoughtCount: number; } /** Validation result for burst session */ export interface BurstValidation { passed: boolean; errors: string[]; warnings: string[]; } /** Result from submit_thinking_session tool */ export interface SubmitSessionResult { status: 'accepted' | 'rejected'; sessionId: string; thoughtsProcessed: number; validation: BurstValidation; metrics: BurstMetrics; thoughtTree?: string; systemAdvice?: string; errorMessage?: string; /** Proactive micro-prompt for self-reflection (v4.6.0) */ nudge?: string; }