Navigation

Account
Loading account...
Documentation

Usage Examples

Code examples for the core 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
// Response: { technical: "Architecture concerns",
//             business: "Cost and ROI analysis",
//             user: "User experience impact",
//             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
});

// Response: { patterns: "Recurring themes",
//             tensions: "Conflicting viewpoints",
//             consensus: "Areas of agreement",
//             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
});

// Process ranked results
matrix.rankings.forEach(option => {
  console.log(`${option.name}: Score ${option.score} (confidence: ${option.confidence})`);
});

// Response: { rankings: [
//             { name: "Provider Name", score: 0.85, confidence: "high" },
//             ...
//             ] }

Example 3: Sensitivity Analysis

Test whether the outcome changes if criteria weights shift.
// Test how weight changes affect the outcome
const sensitivity = await mcp.call_tool("sensitivity_analysis", {
  session_id: analysis.session_id,
  criteria_variance: 0.2,  // Test +/-20% weight variations
  iterations: 100
});

// Response: { flip_rate: "15%", most_sensitive: "Cost" }

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
});

// Note: Continue with process_thought for steps 4 (synthesis) and 5 (conclusion)

Example 3: Generate Summary

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

// Get comprehensive reasoning summary
// Response: { chain: "Full reasoning chain",
//             insights: "Key insights extracted",
//             decision_points: "Critical decision moments",
//             conclusion: "Final recommendation" }

// 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
});

// Get initial response with probing questions
// Response: { initial_response: "Probing questions that 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
});

// Get AI response with suggested exploration paths
// Response: { response: "AI response to your reflection",
//             suggested_thoughts: ["Exploration 1", "Exploration 2", ...] }

// Note: Additional reflect calls can be made for multi-round conversations
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
});

// Get key realizations and patterns from the conversation
// Response: { realizations: "Key realizations from the conversation",
//             patterns: "Patterns noticed during reflection" }

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

// Get comprehensive session summary with action items
// Response: { summary: "Session summary",
//             next_steps: [{ action: "Step 1", owner: "Owner", timeframe: "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.