Skip to main content
Glama

flutter_fix_common_issues

Fix common Flutter development issues by automatically running clean, pub get, pod install, gradle sync, and cache invalidation commands in your project directory.

Instructions

Auto-fix common issues: clean, pub get, pod install, gradle sync, invalidate caches

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdYesWorking directory (Flutter project root)
deepNoPerform deep cleaning (slower but more thorough)

Implementation Reference

  • Registration of the 'flutter_fix_common_issues' tool including inline schema and handler implementation
    tools.set('flutter_fix_common_issues', {
      name: 'flutter_fix_common_issues',
      description: 'Auto-fix common issues: clean, pub get, pod install, gradle sync, invalidate caches',
      inputSchema: {
        type: 'object',
        properties: {
          cwd: {
            type: 'string',
            description: 'Working directory (Flutter project root)'
          },
          deep: {
            type: 'boolean',
            description: 'Perform deep cleaning (slower but more thorough)',
            default: false
          }
        },
        required: ['cwd']
      },
      handler: async (args: any) => {
        const fixes = [];
        
        try {
          // Step 1: Flutter clean
          const cleanResult = await flutterTools.get('flutter_clean').handler({ cwd: args.cwd });
          fixes.push({ step: 'flutter_clean', ...cleanResult });
          
          // Step 2: Flutter pub get
          const pubResult = await flutterTools.get('flutter_pub_get').handler({ cwd: args.cwd });
          fixes.push({ step: 'flutter_pub_get', ...pubResult });
          
          // Step 3: iOS pod install (if on macOS)
          if (process.platform === 'darwin') {
            try {
              const { stdout } = await processExecutor.execute(
                'pod',
                ['install'],
                { cwd: `${args.cwd}/ios` }
              );
              fixes.push({ step: 'pod_install', success: true, data: stdout });
            } catch (e) {
              fixes.push({ step: 'pod_install', success: false, error: 'Pod install failed' });
            }
          }
          
          // Step 4: Deep clean if requested
          if (args.deep) {
            // Remove build directories
            await processExecutor.execute('rm', ['-rf', 'build'], { cwd: args.cwd });
            await processExecutor.execute('rm', ['-rf', '.dart_tool'], { cwd: args.cwd });
            await processExecutor.execute('rm', ['-rf', '.packages'], { cwd: args.cwd });
            
            // Android specific
            await processExecutor.execute('./gradlew', ['clean'], { cwd: `${args.cwd}/android` });
            
            // iOS specific
            if (process.platform === 'darwin') {
              await processExecutor.execute('rm', ['-rf', 'ios/Pods'], { cwd: args.cwd });
              await processExecutor.execute('rm', ['-rf', `${process.env.HOME}/Library/Developer/Xcode/DerivedData`], {});
            }
            
            fixes.push({ step: 'deep_clean', success: true });
          }
          
          return {
            success: true,
            data: {
              fixes,
              message: 'Common issues fixed successfully'
            }
          };
        } catch (error) {
          return {
            success: false,
            error: error instanceof Error ? error.message : String(error),
            data: { fixes }
          };
        }
      }
    });
  • The handler function executes the tool logic: flutter clean, pub get, conditional pod install, and optional deep cleaning with rm and gradlew clean.
    handler: async (args: any) => {
      const fixes = [];
      
      try {
        // Step 1: Flutter clean
        const cleanResult = await flutterTools.get('flutter_clean').handler({ cwd: args.cwd });
        fixes.push({ step: 'flutter_clean', ...cleanResult });
        
        // Step 2: Flutter pub get
        const pubResult = await flutterTools.get('flutter_pub_get').handler({ cwd: args.cwd });
        fixes.push({ step: 'flutter_pub_get', ...pubResult });
        
        // Step 3: iOS pod install (if on macOS)
        if (process.platform === 'darwin') {
          try {
            const { stdout } = await processExecutor.execute(
              'pod',
              ['install'],
              { cwd: `${args.cwd}/ios` }
            );
            fixes.push({ step: 'pod_install', success: true, data: stdout });
          } catch (e) {
            fixes.push({ step: 'pod_install', success: false, error: 'Pod install failed' });
          }
        }
        
        // Step 4: Deep clean if requested
        if (args.deep) {
          // Remove build directories
          await processExecutor.execute('rm', ['-rf', 'build'], { cwd: args.cwd });
          await processExecutor.execute('rm', ['-rf', '.dart_tool'], { cwd: args.cwd });
          await processExecutor.execute('rm', ['-rf', '.packages'], { cwd: args.cwd });
          
          // Android specific
          await processExecutor.execute('./gradlew', ['clean'], { cwd: `${args.cwd}/android` });
          
          // iOS specific
          if (process.platform === 'darwin') {
            await processExecutor.execute('rm', ['-rf', 'ios/Pods'], { cwd: args.cwd });
            await processExecutor.execute('rm', ['-rf', `${process.env.HOME}/Library/Developer/Xcode/DerivedData`], {});
          }
          
          fixes.push({ step: 'deep_clean', success: true });
        }
        
        return {
          success: true,
          data: {
            fixes,
            message: 'Common issues fixed successfully'
          }
        };
      } catch (error) {
        return {
          success: false,
          error: error instanceof Error ? error.message : String(error),
          data: { fixes }
        };
      }
    }
  • Input schema defining cwd (required) and optional deep boolean flag.
    inputSchema: {
      type: 'object',
      properties: {
        cwd: {
          type: 'string',
          description: 'Working directory (Flutter project root)'
        },
        deep: {
          type: 'boolean',
          description: 'Perform deep cleaning (slower but more thorough)',
          default: false
        }
      },
      required: ['cwd']
    },
  • Metadata registration in TOOL_REGISTRY providing category, platform, requirements, and performance info for the tool.
    'flutter_fix_common_issues': {
      name: 'flutter_fix_common_issues',
      category: ToolCategory.ESSENTIAL,
      platform: 'flutter',
      requiredTools: [RequiredTool.FLUTTER],
      description: 'Auto-fix common issues: clean, pub get, pod install, gradle sync, invalidate caches',
      safeForTesting: false,
      performance: { expectedDuration: 60000, timeout: 300000 }
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It lists actions but lacks behavioral details: it doesn't specify execution order, whether operations are sequential/parallel, error handling, time estimates, or side effects (e.g., data loss from cleaning). The description is functional but misses critical operational context for a multi-step tool.

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: the first phrase ('Auto-fix common issues') captures the core purpose, followed by a comma-separated list of actions. Every word earns its place with zero redundancy, making it easy to scan and understand quickly.

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

Completeness2/5

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

Given the tool's complexity (multiple operations) and lack of annotations/output schema, the description is incomplete. It omits behavioral transparency details, usage context, and result expectations. For a tool that performs several potentially destructive actions, more guidance is needed to ensure safe and effective 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%, so the schema fully documents both parameters (cwd, deep). The description adds no parameter-specific information beyond what's in the schema, such as how 'deep' affects each sub-action. Baseline 3 is appropriate as the schema handles the heavy lifting.

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 with specific verbs ('Auto-fix common issues') and lists the concrete actions it performs (clean, pub get, pod install, gradle sync, invalidate caches). It distinguishes itself from siblings like 'flutter_clean' or 'flutter_pub_get' by bundling multiple fixes, though it doesn't explicitly contrast with them.

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 guidance on when to use this tool versus alternatives. It doesn't specify scenarios (e.g., after dependency changes, build failures) or prerequisites, nor does it mention when to use individual sibling tools like 'flutter_clean' instead. Usage is implied but not articulated.

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/cristianoaredes/mcp-mobile-server'

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