Skip to content

Enhancement: Add thought-level completions capability #21

Description

@mettamatt

Overview

Investigate expanding the existing completions capability beyond prompt arguments to include intelligent thought-level completions for the code-reasoning tool.

Current State

  • ✅ Completions capability is already enabled (completions: {} in server capabilities)
  • CompleteRequestSchema handler exists for prompt argument completions
  • ✅ Infrastructure in place with thoughtHistory and branches tracking

Proposed Enhancement

Add intelligent completions for the thought parameter in the code-reasoning tool to help users:

1. Context-Aware Suggestions

  • Analyze thoughtHistory to suggest logical next steps
  • Detect reasoning patterns and suggest continuations
  • Provide programming-specific thought templates

2. Pattern-Based Completions

Based on partial input, suggest completions for common patterns:

  • Debugging: "debugging this by examining...", "debugging step-by-step: first check..."
  • Algorithm Analysis: "analyzing the time complexity...", "considering alternative algorithms..."
  • Code Review: "reviewing this code for...", "potential issues I see..."
  • System Design: "breaking this system into components...", "considering scalability..."

3. Structured Reasoning Templates

Auto-suggest based on reasoning context:

  • Branching: "Let me explore an alternative approach: "
  • Revision: "I need to revise my earlier thinking about "
  • Analysis: "Breaking this down into components: "

Technical Implementation Ideas

// Extend existing CompleteRequestSchema handler
if (req.params.ref.type === 'ref/tool' && req.params.ref.name === 'code-reasoning') {
  const argName = req.params.argument.name;
  if (argName === 'thought') {
    return await this.getThoughtCompletions(req.params.argument.value);
  }
}

private getThoughtCompletions(partialThought: string): CompletionResult {
  // Analyze thought history, detect patterns, suggest continuations
}

Benefits

  • Improved UX: Helps users formulate better reasoning chains
  • Pattern Recognition: Guides users toward effective problem-solving approaches
  • Consistency: Encourages following the tool's "CRITICAL CHECKLIST"
  • Productivity: Reduces cognitive load for complex programming analysis

Investigation Tasks

  • Research MCP completion patterns for tool parameters (not just prompts)
  • Design completion suggestion algorithms based on thought history
  • Create programming-specific reasoning pattern templates
  • Prototype implementation and test with real scenarios
  • Evaluate impact on reasoning quality and user experience

Related

This builds on the existing completions infrastructure introduced in MCP SDK 1.12.3 (fixed in the current dependency update PR #19).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions