decisionframework
Analyze complex decisions using structured frameworks to evaluate options, criteria, and outcomes systematically.
Instructions
A detailed tool for structured decision analysis and rational choice. This tool helps models systematically evaluate options, criteria, and outcomes. It supports multiple decision frameworks, probability estimates, and value judgments.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| decisionStatement | Yes | ||
| options | Yes | ||
| criteria | No | ||
| analysisType | Yes | ||
| stage | Yes | ||
| stakeholders | No | ||
| constraints | No | ||
| timeHorizon | No | ||
| riskTolerance | No | ||
| possibleOutcomes | No | ||
| recommendation | No | ||
| rationale | No | ||
| decisionId | Yes | Unique identifier for this decision analysis | |
| iteration | Yes | Current iteration of the decision process | |
| nextStageNeeded | Yes | Whether another stage is needed in the process |
Implementation Reference
- Core handler function for the 'decisionframework' tool. Validates input using validateInputData, formats detailed output with chalk colors and logs to console.error, then returns the validated data.public processDecisionFramework(input: unknown): DecisionFrameworkData { const validatedData = this.validateInputData(input); // Log formatted output to console const formattedOutput = this.formatOutput(validatedData); console.error(formattedOutput); return validatedData; }
- Helper method to format the DecisionFrameworkData into a colored, structured console output string using chalk for different sections like decision statement, options, criteria, etc.private formatOutput(data: DecisionFrameworkData): string { const { decisionStatement, options, analysisType, stage, iteration } = data; let output = `\n${chalk.bold.blue('Decision Framework Analysis')}\n`; output += `${chalk.bold.green('Decision Statement:')} ${decisionStatement}\n`; output += `${chalk.bold.yellow('Analysis Type:')} ${analysisType}\n`; output += `${chalk.bold.magenta('Stage:')} ${stage} (Iteration: ${iteration})\n`; // Options if (options.length > 0) { output += `\n${chalk.bold.cyan('Options:')}\n`; options.forEach((option, i) => { output += `${chalk.bold(`Option ${i+1}: ${option.name}`)}\n`; output += `${option.description}\n\n`; }); } // Criteria if (data.criteria && data.criteria.length > 0) { output += `\n${chalk.bold.green('Criteria:')}\n`; data.criteria.forEach((criterion, i) => { output += `${chalk.bold(`${criterion.name} (weight: ${criterion.weight.toFixed(2)}):`)} `; output += `${criterion.description}\n`; }); } // Stakeholders if (data.stakeholders && data.stakeholders.length > 0) { output += `\n${chalk.bold.yellow('Stakeholders:')} ${data.stakeholders.join(', ')}\n`; } // Constraints if (data.constraints && data.constraints.length > 0) { output += `\n${chalk.bold.red('Constraints:')}\n`; data.constraints.forEach((constraint, i) => { output += `${chalk.bold(`${i+1}.`)} ${constraint}\n`; }); } // Recommendation if (data.recommendation) { output += `\n${chalk.bold.green('Recommendation:')}\n${data.recommendation}\n`; if (data.rationale) { output += `\n${chalk.bold.cyan('Rationale:')}\n${data.rationale}\n`; } } return output; }
- Helper method to validate the input data against required fields and types for DecisionFrameworkData, throwing descriptive errors if invalid.private validateInputData(input: unknown): DecisionFrameworkData { const data = input as DecisionFrameworkData; if (!data.decisionStatement || !data.options || !data.analysisType || !data.stage || !data.decisionId) { throw new Error("Invalid input for DecisionFramework: Missing required fields."); } if (typeof data.iteration !== 'number' || data.iteration < 0) { throw new Error("Invalid iteration value for DecisionFrameworkData."); } if (typeof data.nextStageNeeded !== 'boolean') { throw new Error("Invalid nextStageNeeded value for DecisionFrameworkData."); } return data; }
- src/models/interfaces.ts:149-176 (schema)TypeScript interface defining the structure of data for the decision framework tool, including required and optional fields matching the tool's input schema.export interface DecisionFrameworkData { decisionStatement: string; options: OptionData[]; criteria?: CriterionData[]; analysisType: | "pros-cons" | "weighted-criteria" | "decision-tree" | "expected-value" | "scenario-analysis"; stage: | "problem-definition" | "options-generation" | "criteria-definition" | "evaluation" | "sensitivity-analysis" | "decision"; stakeholders?: string[]; constraints?: string[]; timeHorizon?: string; riskTolerance?: "risk-averse" | "risk-neutral" | "risk-seeking"; possibleOutcomes?: OutcomeData[]; recommendation?: string; rationale?: string; decisionId: string; iteration: number; nextStageNeeded: boolean; }
- src/index.ts:1110-1122 (registration)Registration and dispatch handler in the MCP server's CallToolRequestHandler switch statement that routes 'decisionframework' tool calls to the DecisionFrameworkServer.processDecisionFramework method and formats the response.case "decisionframework": { const result = decisionFrameworkServer.processDecisionFramework( request.params.arguments ); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; }