Skip to main content
Glama

advanced_reasoning

Enhance complex reasoning with meta-cognitive assessment, hypothesis testing, and graph-based memory. Track confidence, validate evidence, and manage session context for systematic problem-solving and decision-making.

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

Implementation Reference

  • Main handler function that executes the advanced_reasoning tool logic: validates input, stores thoughts in memory, handles branching, logs formatted output, and returns structured response with memory stats.
    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 } ); // 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 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(), relatedMemories: relatedMemories.map(m => ({ content: m.content, confidence: m.confidence })) }, 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 }; } }
  • Tool schema definition including detailed input validation schema, description, and required parameters for the advanced_reasoning tool.
    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:1302-1315 (registration)
    Registration of the advanced_reasoning tool in the list of available 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:1321-1323 (registration)
    Tool dispatch registration in the CallToolRequestSchema switch statement, routing calls to the handler method.
    case "advanced_reasoning": return reasoningServer.processAdvancedThought(args);
  • Helper function for input validation and normalization used by the handler.
    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, }; }

Other Tools

Related 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