Skip to main content
Glama
angrysky56

Advanced Reasoning MCP Server

advanced_reasoning

Perform complex reasoning with meta-cognitive reflection, hypothesis testing, and memory integration to systematically analyze problems and track confidence.

Instructions

Advanced cognitive reasoning tool that builds on sequential thinking with meta-cognition, hypothesis testing, and integrated memory.

Key Features:

  • Meta-cognitive assessment and confidence tracking

  • Hypothesis formulation and testing capabilities

  • Integrated graph-based memory system

  • Dynamic reasoning quality evaluation

  • Session-based context management

  • Evidence tracking and validation

Enhanced Parameters:

  • thought: Your reasoning step (required)

  • thoughtNumber/totalThoughts: Sequential tracking (required)

  • nextThoughtNeeded: Continue flag (required)

  • confidence: Self-assessment 0.0-1.0 (default: 0.5)

  • reasoning_quality: 'low'|'medium'|'high' (default: 'medium')

  • meta_thought: Reflection on your reasoning process

  • hypothesis: Current working hypothesis

  • test_plan: How to validate the hypothesis

  • test_result: Outcome of testing

  • evidence: Supporting/contradicting evidence

  • session_id: Link to reasoning session

  • goal: Overall objective

  • progress: 0.0-1.0 completion estimate

Branching (inherited from sequential thinking):

  • isRevision/revisesThought: Revise previous thoughts

  • branchFromThought/branchId: Explore alternatives

Use this tool for complex reasoning that benefits from:

  • Self-reflection and confidence tracking

  • Systematic hypothesis development

  • Memory of previous insights

  • Quality assessment of reasoning

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
thoughtYesYour current reasoning step
nextThoughtNeededYesWhether another thought step is needed
thoughtNumberYesCurrent thought number
totalThoughtsYesEstimated total thoughts needed
confidenceNoConfidence in this reasoning step (0.0-1.0)
reasoning_qualityNoAssessment of reasoning quality
meta_thoughtNoMeta-cognitive reflection on your reasoning process
goalNoOverall goal or objective
progressNoProgress toward goal (0.0-1.0)
hypothesisNoCurrent working hypothesis
test_planNoPlan for testing the hypothesis
test_resultNoResult of hypothesis testing
evidenceNoEvidence for/against hypothesis
session_idNoReasoning session identifier
builds_onNoPrevious thoughts this builds on
challengesNoIdeas this challenges or contradicts
isRevisionNoWhether this revises previous thinking
revisesThoughtNoWhich thought is being reconsidered
branchFromThoughtNoBranching point thought number
branchIdNoBranch identifier
needsMoreThoughtsNoIf more thoughts are needed

Implementation Reference

  • Core handler that processes advanced reasoning input: validates data, stores in memory and history, handles branching, logs formatted thoughts, queries related memories, and returns JSON status with suggestions.
    public processAdvancedThought(input: unknown): { content: Array<{ type: string; text: string }>; isError?: boolean } {
      try {
        const validatedInput = this.validateThoughtData(input);
    
        // Auto-adjust total thoughts if needed
        if (validatedInput.thoughtNumber > validatedInput.totalThoughts) {
          validatedInput.totalThoughts = validatedInput.thoughtNumber;
        }
    
        // Store in memory if session provided
        if (validatedInput.session_id) {
          const nodeId = this.memory.addNode(
            validatedInput.thought,
            'thought',
            {
              confidence: validatedInput.confidence,
              reasoning_quality: validatedInput.reasoning_quality,
              thoughtNumber: validatedInput.thoughtNumber,
              hypothesis: validatedInput.hypothesis
            }
          );
    
          // NEW: Create graph edges from builds_on references
          // We interpret strings in builds_on as Node IDs
          if (validatedInput.builds_on && validatedInput.builds_on.length > 0) {
            validatedInput.builds_on.forEach(targetId => {
              this.memory.connectNodes(nodeId, targetId);
            });
          }
    
          // Update session context
          this.memory.updateSession(validatedInput.session_id, {
            currentFocus: validatedInput.thought,
            confidence: validatedInput.confidence,
            reasoning_quality: validatedInput.reasoning_quality,
            meta_assessment: validatedInput.meta_thought
          });
        }
    
        // Add to history
        this.thoughtHistory.push(validatedInput);
    
        // Handle branching
        if (validatedInput.branchFromThought && validatedInput.branchId) {
          if (!this.branches[validatedInput.branchId]) {
            this.branches[validatedInput.branchId] = [];
          }
          this.branches[validatedInput.branchId].push(validatedInput);
        }
    
        // Format and log
        if (!this.disableLogging) {
          const formattedThought = this.formatAdvancedThought(validatedInput);
          console.error(formattedThought);
        }
    
        // Generate related memories if session provided (for output)
        // NEW: Passive context injection - automatically suggest connections
        let relatedMemories: MemoryNode[] = [];
        if (validatedInput.session_id) {
          relatedMemories = this.memory.queryRelated(validatedInput.thought, 3);
        }
    
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              thoughtNumber: validatedInput.thoughtNumber,
              totalThoughts: validatedInput.totalThoughts,
              nextThoughtNeeded: validatedInput.nextThoughtNeeded,
              confidence: validatedInput.confidence,
              reasoning_quality: validatedInput.reasoning_quality,
              meta_assessment: validatedInput.meta_thought,
              hypothesis: validatedInput.hypothesis,
              branches: Object.keys(this.branches),
              thoughtHistoryLength: this.thoughtHistory.length,
              memoryStats: this.memory.getMemoryStats(),
              // Enhanced output with passive suggestions
              relatedMemories: relatedMemories.map(m => ({ content: m.content, confidence: m.confidence })),
              suggested_connections: relatedMemories.map(m => m.id),
              consistency_note: relatedMemories.length > 0 ? "Verify consistency with related thoughts above" : undefined
            }, null, 2)
          }]
        };
      } catch (error) {
        return {
          content: [{
            type: "text",
            text: JSON.stringify({
              error: error instanceof Error ? error.message : String(error),
              status: 'failed'
            }, null, 2)
          }],
          isError: true
        };
      }
    }
  • Defines the Tool object for 'advanced_reasoning' including name, detailed description, and comprehensive inputSchema specifying all parameters with types, descriptions, and required fields.
    const ADVANCED_REASONING_TOOL: Tool = {
      name: "advanced_reasoning",
      description: `Advanced cognitive reasoning tool that builds on sequential thinking with meta-cognition, hypothesis testing, and integrated memory.
    
    Key Features:
    - Meta-cognitive assessment and confidence tracking
    - Hypothesis formulation and testing capabilities
    - Integrated graph-based memory system
    - Dynamic reasoning quality evaluation
    - Session-based context management
    - Evidence tracking and validation
    
    Enhanced Parameters:
    - thought: Your reasoning step (required)
    - thoughtNumber/totalThoughts: Sequential tracking (required)
    - nextThoughtNeeded: Continue flag (required)
    - confidence: Self-assessment 0.0-1.0 (default: 0.5)
    - reasoning_quality: 'low'|'medium'|'high' (default: 'medium')
    - meta_thought: Reflection on your reasoning process
    - hypothesis: Current working hypothesis
    - test_plan: How to validate the hypothesis
    - test_result: Outcome of testing
    - evidence: Supporting/contradicting evidence
    - session_id: Link to reasoning session
    - goal: Overall objective
    - progress: 0.0-1.0 completion estimate
    
    Branching (inherited from sequential thinking):
    - isRevision/revisesThought: Revise previous thoughts
    - branchFromThought/branchId: Explore alternatives
    
    Use this tool for complex reasoning that benefits from:
    - Self-reflection and confidence tracking
    - Systematic hypothesis development
    - Memory of previous insights
    - Quality assessment of reasoning`,
      inputSchema: {
        type: "object",
        properties: {
          // Core sequential thinking fields
          thought: { type: "string", description: "Your current reasoning step" },
          nextThoughtNeeded: { type: "boolean", description: "Whether another thought step is needed" },
          thoughtNumber: { type: "integer", description: "Current thought number", minimum: 1 },
          totalThoughts: { type: "integer", description: "Estimated total thoughts needed", minimum: 1 },
    
          // Advanced cognitive fields
          confidence: { type: "number", description: "Confidence in this reasoning step (0.0-1.0)", minimum: 0, maximum: 1 },
          reasoning_quality: { type: "string", description: "Assessment of reasoning quality", enum: ["low", "medium", "high"] },
          meta_thought: { type: "string", description: "Meta-cognitive reflection on your reasoning process" },
          goal: { type: "string", description: "Overall goal or objective" },
          progress: { type: "number", description: "Progress toward goal (0.0-1.0)", minimum: 0, maximum: 1 },
    
          // Hypothesis testing
          hypothesis: { type: "string", description: "Current working hypothesis" },
          test_plan: { type: "string", description: "Plan for testing the hypothesis" },
          test_result: { type: "string", description: "Result of hypothesis testing" },
          evidence: { type: "array", items: { type: "string" }, description: "Evidence for/against hypothesis" },
    
          // Memory and context
          session_id: { type: "string", description: "Reasoning session identifier" },
          builds_on: { type: "array", items: { type: "string" }, description: "Previous thoughts this builds on" },
          challenges: { type: "array", items: { type: "string" }, description: "Ideas this challenges or contradicts" },
    
          // Branching (inherited)
          isRevision: { type: "boolean", description: "Whether this revises previous thinking" },
          revisesThought: { type: "integer", description: "Which thought is being reconsidered", minimum: 1 },
          branchFromThought: { type: "integer", description: "Branching point thought number", minimum: 1 },
          branchId: { type: "string", description: "Branch identifier" },
          needsMoreThoughts: { type: "boolean", description: "If more thoughts are needed" }
        },
        required: ["thought", "nextThoughtNeeded", "thoughtNumber", "totalThoughts"]
      }
    };
  • src/index.ts:1394-1407 (registration)
    Registers the advanced_reasoning tool (as ADVANCED_REASONING_TOOL) in the list of tools returned by the ListToolsRequestSchema handler.
    server.setRequestHandler(ListToolsRequestSchema, async () => ({
      tools: [
        ADVANCED_REASONING_TOOL,
        QUERY_MEMORY_TOOL,
        CREATE_LIBRARY_TOOL,
        LIST_LIBRARIES_TOOL,
        SWITCH_LIBRARY_TOOL,
        GET_LIBRARY_INFO_TOOL,
        CREATE_SYSTEM_JSON_TOOL,
        GET_SYSTEM_JSON_TOOL,
        SEARCH_SYSTEM_JSON_TOOL,
        LIST_SYSTEM_JSON_TOOL
      ],
    }));
  • src/index.ts:1412-1415 (registration)
    In the CallToolRequestSchema handler, the switch statement case for 'advanced_reasoning' dispatches execution to the reasoningServer's processAdvancedThought method.
    switch (name) {
      case "advanced_reasoning":
        return reasoningServer.processAdvancedThought(args);
  • Helper method called by the handler to validate and normalize the input thought data, ensuring required fields and providing defaults for optional ones.
    private validateThoughtData(input: unknown): AdvancedThoughtData {
      const data = input as Record<string, unknown>;
    
      // Validate core fields
      if (!data.thought || typeof data.thought !== 'string') {
        throw new Error('Invalid thought: must be a string');
      }
      if (!data.thoughtNumber || typeof data.thoughtNumber !== 'number') {
        throw new Error('Invalid thoughtNumber: must be a number');
      }
      if (!data.totalThoughts || typeof data.totalThoughts !== 'number') {
        throw new Error('Invalid totalThoughts: must be a number');
      }
      if (typeof data.nextThoughtNeeded !== 'boolean') {
        throw new Error('Invalid nextThoughtNeeded: must be a boolean');
      }
    
      // Validate advanced fields with defaults
      const confidence = typeof data.confidence === 'number' ? data.confidence : 0.5;
      const reasoning_quality = ['low', 'medium', 'high'].includes(data.reasoning_quality as string)
        ? data.reasoning_quality as 'low' | 'medium' | 'high'
        : 'medium';
    
      return {
        thought: data.thought,
        thoughtNumber: data.thoughtNumber,
        totalThoughts: data.totalThoughts,
        nextThoughtNeeded: data.nextThoughtNeeded,
        confidence,
        reasoning_quality,
        meta_thought: data.meta_thought as string || '',
        goal: data.goal as string,
        progress: data.progress as number,
        hypothesis: data.hypothesis as string,
        test_plan: data.test_plan as string,
        test_result: data.test_result as string,
        evidence: data.evidence as string[],
        session_id: data.session_id as string,
        builds_on: data.builds_on as string[],
        challenges: data.challenges as string[],
        isRevision: data.isRevision as boolean,
        revisesThought: data.revisesThought as number,
        branchFromThought: data.branchFromThought as number,
        branchId: data.branchId as string,
        needsMoreThoughts: data.needsMoreThoughts as boolean,
      };
    }
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It describes key features like 'meta-cognitive assessment,' 'hypothesis testing,' 'integrated graph-based memory system,' and 'session-based context management,' which gives useful context about the tool's capabilities. However, it doesn't address important behavioral aspects like whether this tool persists data, has rate limits, requires authentication, or what happens when invoked (e.g., does it store reasoning steps somewhere?). The description adds value but leaves significant behavioral questions unanswered.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with sections for key features, parameters, and usage guidelines, which helps organization. However, it's quite lengthy with redundant parameter explanations that duplicate schema content. The 'Enhanced Parameters' section is particularly verbose given the 100% schema coverage. Some sentences like 'Branching (inherited from sequential thinking)' could be more concise. The structure is good but the content could be more efficiently presented.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the high complexity (21 parameters, no annotations, no output schema), the description provides reasonable context about the tool's purpose and features. However, it doesn't explain what the tool actually returns or produces (no output schema means the description should address this gap). For a sophisticated reasoning tool with many parameters, the description should more clearly explain the overall workflow and expected outcomes. It's adequate but has clear gaps for such a complex tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 21 parameters thoroughly. The description's 'Enhanced Parameters' section lists and briefly explains each parameter, but this mostly repeats what's in the schema descriptions without adding significant new meaning. For example, it states 'confidence: Self-assessment 0.0-1.0' while the schema says 'Confidence in this reasoning step (0.0-1.0)' - nearly identical. The description adds minimal value beyond the comprehensive schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states this is an 'advanced cognitive reasoning tool' for 'complex reasoning that benefits from self-reflection, systematic hypothesis development, memory of previous insights, and quality assessment.' It distinguishes from siblings by focusing on reasoning processes rather than memory/library management or JSON operations. However, it doesn't specify what resource it acts upon (e.g., 'processes reasoning steps' would be more specific).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use this tool: 'for complex reasoning that benefits from self-reflection and confidence tracking, systematic hypothesis development, memory of previous insights, and quality assessment of reasoning.' This gives clear context for application. However, it doesn't mention when NOT to use it or explicitly contrast with sibling tools (e.g., 'use query_reasoning_memory for retrieving past reasoning instead').

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/angrysky56/advanced-reasoning-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server