Skip to main content
Glama

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

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