Skip to main content
Glama

break_down_problem

Break complex problems into manageable sub-problems using sequential, hierarchical, or dependency-based approaches to simplify analysis and solution development.

Instructions

break down|divide|split into parts|decompose|step by step|subdivide - Break complex problems into sub-problems

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
problemYesComplex problem to break down
maxDepthNoMaximum breakdown depth
approachNoBreakdown approach

Implementation Reference

  • The main handler function implementing the `break_down_problem` tool. It parses code using TypeScript AST if applicable, generates hierarchical sub-problems recursively, and formats the output as a structured breakdown with execution order.
    export async function breakDownProblem(args: { problem: string; maxDepth?: number; approach?: string }): Promise<ToolResult> {
      const { problem: breakdownProblem, maxDepth = 3, approach = 'hierarchical' } = args;
      
      // If input appears to be code, attempt AST-based structure decomposition
      let codeStructureSubProblems: SubProblem[] | null = null;
      if (breakdownProblem.includes('function') || breakdownProblem.includes('class') || breakdownProblem.includes('=>')) {
        try {
          const sourceFile = AST_PROJECT.createSourceFile('temp.ts', breakdownProblem, {
            overwrite: true,
            scriptKind: ScriptKind.TS
          });
          const funcs = sourceFile.getFunctions();
          const classes = sourceFile.getClasses();
          const vars = sourceFile.getVariableDeclarations();
          codeStructureSubProblems = [];
          funcs.forEach((f, i) => {
            codeStructureSubProblems!.push({
              id: `codeFunc${i+1}`,
              title: `Function analysis: ${f.getName() || 'anonymous function'}`,
              description: f.getText().slice(0, 100) + (f.getText().length > 100 ? '...' : ''),
              complexity: 'medium',
              priority: 'high',
              dependencies: []
            });
          });
          classes.forEach((c, i) => {
            codeStructureSubProblems!.push({
              id: `codeClass${i+1}`,
              title: `Class analysis: ${c.getName() || 'anonymous class'}`,
              description: c.getText().slice(0, 100) + (c.getText().length > 100 ? '...' : ''),
              complexity: 'high',
              priority: 'high',
              dependencies: []
            });
          });
          vars.forEach((v, i) => {
            codeStructureSubProblems!.push({
              id: `codeVar${i+1}`,
              title: `Variable analysis: ${v.getName()}`,
              description: v.getText().slice(0, 100) + (v.getText().length > 100 ? '...' : ''),
              complexity: 'low',
              priority: 'medium',
              dependencies: []
            });
          });
          if (codeStructureSubProblems.length === 0) codeStructureSubProblems = null;
        } catch (e) {
          codeStructureSubProblems = null;
        }
      }
      
      const generateSubProblems = (parentProblem: string, depth: number, maxDepth: number): SubProblem[] | null => {
        if (depth >= maxDepth) return null;
        
        const subProblems: SubProblem[] = [
          {
            id: `${depth}.1`,
            title: `Understanding ${parentProblem}`,
            description: `Analyze and understand the core aspects of ${parentProblem}`,
            complexity: 'low' as const,
            priority: 'high' as const,
            dependencies: []
          },
          {
            id: `${depth}.2`, 
            title: `Planning solution for ${parentProblem}`,
            description: `Create detailed plan to solve ${parentProblem}`,
            complexity: 'medium' as const,
            priority: 'high' as const,
            dependencies: [`${depth}.1`]
          },
          {
            id: `${depth}.3`,
            title: `Implementing solution for ${parentProblem}`,
            description: `Execute the planned solution for ${parentProblem}`,
            complexity: 'high' as const,
            priority: 'medium' as const,
            dependencies: [`${depth}.2`]
          }
        ];
        
        if (depth < maxDepth - 1) {
          subProblems.forEach((subProblem: SubProblem) => {
            subProblem.subProblems = generateSubProblems(subProblem.title, depth + 1, maxDepth);
          });
        }
        
        return subProblems;
      };
      
      const problemBreakdown = {
        action: 'break_down_problem',
        problem: breakdownProblem,
        approach,
        maxDepth,
        breakdown: {
          rootProblem: {
            id: '0',
            title: breakdownProblem,
            description: `Root problem: ${breakdownProblem}`,
            complexity: 'high',
            subProblems: codeStructureSubProblems || generateSubProblems(breakdownProblem, 1, maxDepth)
          }
        },
        executionOrder: approach === 'dependency-based' ? 
          ['Understanding phase', 'Planning phase', 'Implementation phase'] :
          approach === 'sequential' ?
          ['Step 1', 'Step 2', 'Step 3', '...'] :
          ['Top-level analysis', 'Mid-level breakdown', 'Detailed tasks'],
        status: 'success'
      };
      
      const formatSubProblems = (subs: SubProblem[] | null, indent = 0): string => {
        if (!subs) return '';
        return subs.map(s => `${'  '.repeat(indent)}- ${s.title} (${s.complexity}, ${s.priority})${s.subProblems ? '\n' + formatSubProblems(s.subProblems, indent + 1) : ''}`).join('\n');
      };
    
      return {
        content: [{ type: 'text', text: `Problem: ${breakdownProblem}\nApproach: ${approach}\nMax Depth: ${maxDepth}\n\nBreakdown:\n${formatSubProblems(problemBreakdown.breakdown.rootProblem.subProblems)}\n\nExecution: ${problemBreakdown.executionOrder.join(' → ')}` }]
      };
    }
  • The ToolDefinition object defining the schema, description, and annotations for the `break_down_problem` tool.
    export const breakDownProblemDefinition: ToolDefinition = {
      name: 'break_down_problem',
      description: 'break down|divide|split into parts|decompose|step by step|subdivide - Break complex problems into sub-problems',
      inputSchema: {
        type: 'object',
        properties: {
          problem: { type: 'string', description: 'Complex problem to break down' },
          maxDepth: { type: 'number', description: 'Maximum breakdown depth' },
          approach: { type: 'string', description: 'Breakdown approach', enum: ['sequential', 'hierarchical', 'dependency-based'] }
        },
        required: ['problem']
      },
      annotations: {
        title: 'Break Down Problem',
        audience: ['user', 'assistant']
      }
    };
  • src/index.ts:622-623 (registration)
    The switch case in the tool execution dispatcher that routes calls to `break_down_problem` to the handler function.
    case 'break_down_problem':
      return await breakDownProblem(args as any) as CallToolResult;
  • src/index.ts:116-116 (registration)
    Inclusion of the tool definition in the central `tools` array used for listing available tools.
    breakDownProblemDefinition,
  • src/index.ts:80-80 (registration)
    Import statement bringing in the handler and definition for use in the main server.
    import { breakDownProblem, breakDownProblemDefinition } from './tools/thinking/breakDownProblem.js';
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations only provide a title ('Break Down Problem'), so the description carries the burden of behavioral disclosure. It describes the tool's function (decomposition) but lacks details on behavioral traits such as output format, computational limits, or error handling. No contradiction with annotations exists, but the description is minimal beyond the basic action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and front-loaded, using a single sentence with synonyms to reinforce the purpose. Every word earns its place, avoiding redundancy and maintaining clarity without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (3 parameters, no output schema) and minimal annotations, the description is adequate but incomplete. It covers the basic purpose but lacks context on output, error cases, or integration with sibling tools, making it minimally viable but with clear gaps for effective agent use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear descriptions for all parameters (problem, maxDepth, approach). The description adds no additional semantic context beyond what the schema provides, such as examples or usage tips. With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't compensate but doesn't detract either.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose as breaking complex problems into sub-problems with specific verbs like 'break down,' 'divide,' and 'decompose.' It distinguishes from some siblings like 'analyze_complexity' or 'step_by_step_analysis' by focusing on decomposition rather than analysis or execution. However, it could be more specific about the resource or domain (e.g., 'problem-solving tasks') to fully differentiate from all siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no explicit guidance on when to use this tool versus alternatives like 'analyze_problem' or 'step_by_step_analysis.' It lacks context about prerequisites, exclusions, or comparisons with sibling tools, leaving the agent to infer usage based on the name and description alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other 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/ssdeanx/ssd-ai'

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