Navigation

Documentation

Usage Examples

Comprehensive code examples for all 4 MCP reasoning services. Copy, adapt, and integrate these patterns into your applications.

Context Switcher

Multi-perspective analysis framework that orchestrates parallel analysis from different viewpoints (technical, business, user, risk) to explore complex decisions systematically.

Example 1: Cloud Migration Analysis

Analyze a cloud migration decision from multiple stakeholder perspectives simultaneously.
// Start multi-perspective analysis
const session = await mcp.call_tool("start_context_analysis", {
  topic: "Evaluate moving legacy monolith to microservices",
  initial_perspectives: ["technical", "business", "user", "risk"]
});

// Broadcast question to all perspectives
const analysis = await mcp.call_tool("analyze_from_perspectives", {
  session_id: session.session_id,
  prompt: "What are the critical risks and failure modes?"
});

// Each perspective provides independent analysis
console.log(analysis.technical);  // Architecture concerns
console.log(analysis.business);   // Cost and ROI analysis
console.log(analysis.user);       // User experience impact
console.log(analysis.risk);       // Risk assessment

Example 2: Add Domain Expert Perspective

Create a custom perspective for specialized domain expertise.
// Add HIPAA compliance perspective
await mcp.call_tool("add_perspective_tool", {
  session_id: session.session_id,
  name: "HIPAA Compliance Officer",
  description: "Healthcare data protection and regulatory requirements"
});

// Run analysis with new perspective included
const compliance = await mcp.call_tool("analyze_from_perspectives", {
  session_id: session.session_id,
  prompt: "Are there HIPAA compliance gaps in this architecture?"
});

Example 3: Synthesize Findings

Combine insights from all perspectives into actionable recommendations.
// Synthesize across all perspectives
const synthesis = await mcp.call_tool("synthesize_perspectives", {
  session_id: session.session_id
});

// Returns patterns, tensions, consensus, and recommendations
console.log(synthesis.patterns);        // Recurring themes
console.log(synthesis.tensions);        // Conflicting viewpoints
console.log(synthesis.consensus);       // Areas of agreement
console.log(synthesis.recommendations); // Prioritized actions

Decision Matrix

Systematic multi-criteria decision analysis using weighted scoring to evaluate options against criteria objectively.

Example 1: Cloud Provider Selection

Compare cloud providers using weighted criteria for objective decision-making.
// Start decision analysis
const analysis = await mcp.call_tool("start_decision_analysis", {
  topic: "Select cloud provider for production deployment",
  options: ["AWS", "Google Cloud", "Azure", "DigitalOcean"]
});

// Add weighted evaluation criteria
await mcp.call_tool("add_criterion", {
  session_id: analysis.session_id,
  name: "Cost",
  description: "Annual infrastructure costs",
  weight: 0.25
});

await mcp.call_tool("add_criterion", {
  session_id: analysis.session_id,
  name: "Performance",
  description: "Latency and throughput characteristics",
  weight: 0.30
});

await mcp.call_tool("add_criterion", {
  session_id: analysis.session_id,
  name: "Learning Curve",
  description: "Team familiarity and training effort",
  weight: 0.25
});

Example 2: Evaluate and Rank Options

Run AI-powered evaluation to score each option against all criteria.
// Run evaluation
await mcp.call_tool("evaluate_options", {
  session_id: analysis.session_id
});

// Get ranked results with recommendations
const matrix = await mcp.call_tool("get_decision_matrix", {
  session_id: analysis.session_id
});

// Returns ranked options with scores and confidence levels
matrix.rankings.forEach(option => {
  console.log(`${option.name}: ${option.score} (confidence: ${option.confidence})`);
});

Example 3: Sensitivity Analysis

Test how robust your decision is if criteria weights change.
// Test decision robustness
const sensitivity = await mcp.call_tool("sensitivity_analysis", {
  session_id: analysis.session_id,
  criteria_variance: 0.2,  // Test +/-20% weight variations
  iterations: 100
});

// Understand decision stability
console.log(`Winner changes in ${sensitivity.flip_rate}% of scenarios`);
console.log(`Most sensitive criterion: ${sensitivity.most_sensitive}`);

Sequential Thinking

Structured step-by-step reasoning for linear problems requiring transparent reasoning with full visibility into intermediate steps.

Example 1: Algorithm Design Thinking

Work through a complex algorithm design with visible reasoning steps.
// Step 1: Define the problem
await mcp.call_tool("process_thought", {
  thought: "Need O(n log n) sorting for distributed system with network constraints",
  thought_number: 1,
  total_thoughts: 5,
  stage: "Problem Definition",
  tags: ["algorithms", "distributed-systems"],
  next_thought_needed: true
});

// Step 2: Research approaches
await mcp.call_tool("process_thought", {
  thought: "Researching: merge sort (divide-conquer), radix (non-comparative), quicksort variants",
  thought_number: 2,
  total_thoughts: 5,
  stage: "Research",
  axioms_used: ["divide-and-conquer", "comparison-based-sorting"],
  next_thought_needed: true
});

Example 2: Challenge Assumptions

Document and test assumptions during reasoning.
// Step 3: Analyze with explicit assumptions
await mcp.call_tool("process_thought", {
  thought: "Assuming data fits in memory; network bandwidth is primary constraint",
  thought_number: 3,
  total_thoughts: 5,
  stage: "Analysis",
  assumptions_challenged: [
    "Is network bandwidth actually the bottleneck?",
    "Can we guarantee data locality?"
  ],
  next_thought_needed: true
});

// Continue through synthesis and conclusion...

Example 3: Generate Summary

Create a comprehensive summary of the reasoning chain.
// Generate summary of entire reasoning process
const summary = await mcp.call_tool("generate_summary", {});

console.log("Reasoning chain:", summary.chain);
console.log("Key insights:", summary.insights);
console.log("Decision points:", summary.decision_points);
console.log("Final recommendation:", summary.conclusion);

// Optionally save for future reference
await mcp.call_tool("export_session", {
  file_path: "/path/to/reasoning_session.json"
});

Structured Reflection

Guided self-reflection that surfaces what you are missing. Iterative dialogue with insight extraction, key moment tracking, and knowledge preservation.

Example 1: Start Reflection Session

Begin a structured reflection with your AI thinking partner.
// Start analytical reflection session
const session = await mcp.call_tool("start_reflection", {
  topic: "Should we refactor the legacy authentication system?",
  style: "analytical",  // Options: conversational, analytical, supportive, challenging
  use_chain_of_thought: true
});

console.log(`Response: ${session.initial_response}`);
// Probing questions surface assumptions you haven't examined

Example 2: Explore Your Thinking

Continue the dialogue with follow-up reflections.
// Continue the conversation
const reflection = await mcp.call_tool("reflect", {
  session_id: session.session_id,
  thought: "The current system is slow but changing it might break integrations",
  suggest_next_thoughts: true
});

console.log(`Response: ${reflection.response}`);
console.log(`Suggested explorations: ${reflection.suggested_thoughts}`);

// Continue as many rounds as needed...
await mcp.call_tool("reflect", {
  session_id: session.session_id,
  thought: "Actually, I realize the real issue is the password hashing algorithm"
});

Example 3: Extract Insights and Conclude

Synthesize key realizations and create actionable next steps.
// Extract insights from the conversation
const insights = await mcp.call_tool("get_insights", {
  session_id: session.session_id
});

console.log("Key realizations:", insights.realizations);
console.log("Patterns noticed:", insights.patterns);

// Conclude with action items
const conclusion = await mcp.call_tool("conclude_reflection", {
  session_id: session.session_id
});

console.log("Summary:", conclusion.summary);
console.log("Next steps:", conclusion.next_steps);
// Each step includes owner and suggested timeframe

Ready to Integrate?

All services support OAuth 2.1 with PKCE and work with Claude Desktop, Claude.ai, and any MCP-compatible client.