analyze_problem
Analyze and process problem statements using the UCPF framework to enable structured cognitive analysis, knowledge mapping, and perspective generation for advanced problem-solving.
Instructions
Process a problem statement through the full UCPF framework
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| detailed | No | Whether to include detailed analysis | |
| enable_state | No | Whether to enable state management for this analysis | |
| problem | Yes | The problem statement to analyze | |
| session_id | No | Optional session ID for maintaining state between calls |
Input Schema (JSON Schema)
{
"properties": {
"detailed": {
"default": false,
"description": "Whether to include detailed analysis",
"type": "boolean"
},
"enable_state": {
"default": false,
"description": "Whether to enable state management for this analysis",
"type": "boolean"
},
"problem": {
"description": "The problem statement to analyze",
"type": "string"
},
"session_id": {
"description": "Optional session ID for maintaining state between calls",
"type": "string"
}
},
"required": [
"problem"
],
"type": "object"
}
Implementation Reference
- src/tools/analyze-problem.ts:97-113 (handler)The core handler function that processes the input problem using the UCPF framework, generates creative perspectives, and formats the analysis output.export async function analyzeProblem( problem: string, ucpfCore: UcpfCore, creativePatterns: CreativePatterns, stateManager: StateManager, sessionId?: string, detailed: boolean = false ): Promise<string> { // Process the problem through UCPF const analysis = await ucpfCore.processInput(problem, sessionId); // Generate creative perspectives const creativeInsights = creativePatterns.generatePerspectives(problem, 3); // Format the results return formatAnalysis(analysis, creativeInsights); }
- src/index.ts:339-362 (schema)The input schema defining the parameters for the analyze_problem tool, including problem (required), session_id, enable_state, and detailed.inputSchema: { type: "object", properties: { problem: { type: "string", description: "The problem statement to analyze" }, session_id: { type: "string", description: "Optional session ID for maintaining state between calls" }, enable_state: { type: "boolean", description: "Whether to enable state management for this analysis", default: false }, detailed: { type: "boolean", description: "Whether to include detailed analysis", default: false } }, required: ["problem"] }
- src/index.ts:429-476 (registration)The dispatch handler in the MCP tool call request that validates parameters, calls the analyzeProblem function, handles state, and returns the formatted response.case "analyze_problem": { // Validate required parameters if (!args?.problem || typeof args.problem !== "string") { throw new McpError( ErrorCode.InvalidParams, "Required parameter 'problem' must be a string" ); } // Optional parameters const sessionId = args.session_id as string | undefined; const enableState = Boolean(args.enable_state); const detailed = Boolean(args.detailed); // Update state management if needed if (enableState !== stateManager.getState("global")?.enabled) { stateManager.setEnabled(enableState); ucpfCore.setStateEnabled(enableState); } // Process the problem const analysis = await analyzeProblem( args.problem, ucpfCore, creativePatterns, stateManager, sessionId, detailed ); // Store the analysis if state is enabled if (enableState && sessionId) { stateManager.setState(sessionId, { analysis, timestamp: Date.now(), problem: args.problem }); } return { content: [ { type: "text", text: analysis } ] }; }
- src/tools/analyze-problem.ts:13-92 (helper)Helper function that formats the UCPF analysis and creative insights into a structured Markdown presentation.export function formatAnalysis( analysis: UcpfAnalysis, creativeInsights: CreativePerspective[] = [] ): string { const formatSection = (title: string, content: string): string => { return `## ${title}\n\n${content}\n\n`; }; let result = ""; // Format Cognitive State result += formatSection("Cognitive State Assessment", `Current cognitive state: **${analysis.cognitiveState.type}**\n\n` + `${analysis.cognitiveState.description}\n\n` + "**Characteristics:**\n" + analysis.cognitiveState.characteristics .map(char => `- ${char}`) .join("\n") ); // Format Knowledge Mapping result += formatSection("Knowledge Dimension Mapping", "The problem space has been mapped across the following knowledge dimensions:\n\n" + analysis.knowledgeMapping .map(category => ( `### ${category.label}\n` + `**Description:** ${category.description}\n` + (category.examples.length > 0 ? "**Examples:**\n" + category.examples.map(ex => `- ${ex}`).join("\n") : "*No specific examples identified.*") )) .join("\n\n") ); // Format Recursive Questions result += formatSection("Recursive Self-Questioning", "The following questions challenge initial assumptions and perspectives:\n\n" + analysis.recursiveQuestions .map(q => ( `### ${q.question}\n` + `**Purpose:** ${q.purpose}\n` + `**Target Area:** ${q.targetArea}` )) .join("\n\n") ); // Format Creative Perspectives if (creativeInsights.length > 0) { result += formatSection("Creative Perspectives", "These alternative viewpoints open new possibilities:\n\n" + creativeInsights .map(p => ( `### ${p.viewpoint}\n` + `**Rationale:** ${p.rationale}\n` + (p.implications.length > 0 ? "**Implications:**\n" + p.implications.map(i => `- ${i}`).join("\n") : "") + (p.potentialOutcomes.length > 0 ? "\n\n**Potential Outcomes:**\n" + p.potentialOutcomes.map(o => `- ${o}`).join("\n") : "") )) .join("\n\n") ); } // Format Synthesis result += formatSection("Synthesis & Integration", "**Key Insights:**\n" + (analysis.synthesis.insights.length > 0 ? analysis.synthesis.insights.map(i => `- ${i}`).join("\n") : "- *Analysis indicates further exploration needed to generate specific insights.*") + "\n\n**Confidence Level:** " + (analysis.synthesis.confidenceLevel * 100).toFixed(0) + "%" + "\n\n**Uncertainties:**\n" + (analysis.synthesis.uncertainties.length > 0 ? analysis.synthesis.uncertainties.map(u => `- ${u}`).join("\n") : "- *No specific uncertainties identified.*") ); return result; }