Skip to main content
Glama

mentalmodel

Apply structured mental models like First Principles Thinking and Pareto Principle to systematically break down and solve complex problems.

Instructions

A tool for applying structured mental models to problem-solving. Supports various mental models including:

  • First Principles Thinking

  • Opportunity Cost Analysis

  • Error Propagation Understanding

  • Rubber Duck Debugging

  • Pareto Principle

  • Occam's Razor

Each model provides a systematic approach to breaking down and solving problems.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
modelNameYes
problemYes
stepsNo
reasoningNo
conclusionNo

Implementation Reference

  • The `processModel` method acts as the primary handler for the `mentalmodel` tool, coordinating validation, formatting, and result execution.
    public processModel(input: unknown): any {
        try {
            const validatedInput = this.validateModelData(input);
            const formattedOutput = this.formatModelOutput(validatedInput);
            console.error(formattedOutput);
    
            return {
                modelName: validatedInput.modelName,
                status: "success",
                hasSteps: validatedInput.steps.length > 0,
                hasConclusion: !!validatedInput.conclusion,
            };
        } catch (error) {
            return {
                error: error instanceof Error ? error.message : String(error),
                status: "failed",
            };
        }
    }
  • Input validation logic ensuring the required fields for the mental model are present and correctly typed.
    private validateModelData(input: unknown): MentalModelData {
        const data = input as Record<string, unknown>;
    
        if (!data.modelName || typeof data.modelName !== "string") {
            throw new Error("Invalid modelName: must be a string");
        }
        if (!data.problem || typeof data.problem !== "string") {
            throw new Error("Invalid problem: must be a string");
        }
    
        return {
            modelName: data.modelName as string,
            problem: data.problem as string,
            steps: Array.isArray(data.steps) ? data.steps.map(String) : [],
            reasoning:
                typeof data.reasoning === "string"
                    ? (data.reasoning as string)
                    : "",
            conclusion:
                typeof data.conclusion === "string"
                    ? (data.conclusion as string)
                    : "",
        };
  • src/index.ts:1046-1056 (registration)
    The `mentalmodel` tool is registered and invoked within the main MCP tool execution switch case in `src/index.ts`.
    case "mentalmodel": {
        const result = modelServer.processModel(request.params.arguments);
        return {
            content: [
                {
                    type: "text",
                    text: JSON.stringify(result, null, 2),
                },
            ],
        };
    }

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/chirag127/Clear-Thought-MCP-server'

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