Skip to main content
Glama

flutter_release_build

Build signed release versions for mobile platforms (APK, AAB, IPA) from Flutter projects with optional code obfuscation to prepare apps for distribution.

Instructions

Build release versions for all platforms: APK, AAB, IPA with signing

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cwdYesWorking directory (Flutter project root)
platformsNoPlatforms to build for
obfuscateNoObfuscate Dart code

Implementation Reference

  • Primary handler for 'flutter_release_build' tool. Orchestrates release builds for multiple platforms (APK, AAB, IPA) by invoking the underlying 'flutter_build' tool for each platform, handles errors per platform, and aggregates results with artifact paths.
    handler: async (args: any) => {
      const builds: Record<string, any> = {};
      const buildTool = flutterTools.get('flutter_build');
      
      for (const platform of args.platforms || ['apk', 'appbundle']) {
        try {
          const result = await buildTool.handler({
            cwd: args.cwd,
            target: platform,
            buildMode: 'release'
          });
          builds[platform] = result;
        } catch (error) {
          builds[platform] = {
            success: false,
            error: error instanceof Error ? error.message : String(error)
          };
        }
      }
      
      return {
        success: Object.values(builds).some((b: any) => b.success),
        data: {
          builds,
          artifacts: {
            apk: 'build/app/outputs/flutter-apk/app-release.apk',
            appbundle: 'build/app/outputs/bundle/release/app-release.aab',
            ipa: 'build/ios/ipa/*.ipa'
          }
        }
      };
    }
  • Registration of the 'flutter_release_build' super-tool, including name, description, input schema, and handler reference.
    tools.set('flutter_release_build', {
      name: 'flutter_release_build',
      description: 'Build release versions for all platforms: APK, AAB, IPA with signing',
      inputSchema: {
        type: 'object',
        properties: {
          cwd: {
            type: 'string',
            description: 'Working directory (Flutter project root)'
          },
          platforms: {
            type: 'array',
            items: {
              type: 'string',
              enum: ['apk', 'appbundle', 'ipa', 'ios']
            },
            description: 'Platforms to build for',
            default: ['apk', 'appbundle']
          },
          obfuscate: {
            type: 'boolean',
            description: 'Obfuscate Dart code',
            default: true
          }
        },
        required: ['cwd']
      },
      handler: async (args: any) => {
        const builds: Record<string, any> = {};
        const buildTool = flutterTools.get('flutter_build');
        
        for (const platform of args.platforms || ['apk', 'appbundle']) {
          try {
            const result = await buildTool.handler({
              cwd: args.cwd,
              target: platform,
              buildMode: 'release'
            });
            builds[platform] = result;
          } catch (error) {
            builds[platform] = {
              success: false,
              error: error instanceof Error ? error.message : String(error)
            };
          }
        }
        
        return {
          success: Object.values(builds).some((b: any) => b.success),
          data: {
            builds,
            artifacts: {
              apk: 'build/app/outputs/flutter-apk/app-release.apk',
              appbundle: 'build/app/outputs/bundle/release/app-release.aab',
              ipa: 'build/ios/ipa/*.ipa'
            }
          }
        };
      }
    });
  • Underlying 'flutter_build' tool handler called by 'flutter_release_build'. Executes 'flutter build <target> --release' command after validation, handles the actual Flutter CLI build process.
    tools.set('flutter_build', {
      name: 'flutter_build',
      description: 'Build Flutter app for specific target platform',
      inputSchema: {
        type: 'object',
        properties: {
          cwd: { type: 'string', minLength: 1, description: 'Working directory (Flutter project root)' },
          target: { 
            type: 'string',
            enum: ['apk', 'appbundle', 'ipa', 'ios', 'android', 'web', 'windows', 'macos', 'linux'],
            description: 'Build target platform'
          },
          buildMode: {
            type: 'string',
            enum: ['debug', 'profile', 'release'],
            description: 'Build mode'
          },
          flavor: { type: 'string', description: 'Build flavor' }
        },
        required: ['cwd', 'target']
      },
      handler: async (args: any) => {
        const validation = FlutterBuildSchema.safeParse(args);
        if (!validation.success) {
          throw new Error(`Invalid request: ${validation.error.message}`);
        }
    
        const { cwd, target, buildMode = 'debug', flavor } = validation.data;
    
        // Validate that it's a Flutter project
        await validateFlutterProject(cwd);
    
        const flutter_args = ['build', target];
        
        if (buildMode !== 'debug') {
          flutter_args.push(`--${buildMode}`);
        }
        
        if (flavor) {
          flutter_args.push('--flavor', flavor);
        }
    
        const result = await processExecutor.execute('flutter', flutter_args, {
          cwd,
          timeout: 1800000, // 30 minutes timeout for builds
        });
    
        if (result.exitCode !== 0) {
          throw new Error(`Flutter build failed: ${result.stderr || result.stdout}`);
        }
    
        return {
          success: true,
          data: {
            target,
            buildMode,
            flavor,
            projectPath: cwd,
            output: result.stdout,
            duration: result.duration,
            exitCode: result.exitCode,
          },
        };
      }
    });
  • Zod schema for validating inputs to the 'flutter_build' tool, used by 'flutter_release_build' indirectly.
    const FlutterBuildSchema = z.object({
      cwd: z.string().min(1),
      target: z.enum(['apk', 'appbundle', 'ipa', 'ios', 'android', 'web', 'windows', 'macos', 'linux']),
      buildMode: z.enum(['debug', 'profile', 'release']).default('debug'),
      flavor: z.string().optional(),
    });
  • Metadata and categorization for 'flutter_release_build' tool, defining requirements, performance expectations, and category.
    'flutter_release_build': {
      name: 'flutter_release_build',
      category: ToolCategory.ESSENTIAL,
      platform: 'flutter',
      requiredTools: [RequiredTool.FLUTTER, RequiredTool.GRADLE, RequiredTool.XCODEBUILD],
      description: 'Build release versions for all platforms: APK, AAB, IPA with signing',
      safeForTesting: false,
      performance: { expectedDuration: 300000, timeout: 1200000 }
    },
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 of behavioral disclosure. It mentions 'with signing', hinting at authentication or key requirements, but doesn't specify what signing entails (e.g., needing keystore files or certificates). It also omits critical details like whether this is a destructive operation (e.g., overwriting files), expected runtime, output locations, or error handling. For a build tool with no annotation coverage, this is a significant gap.

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 a single, efficient sentence that front-loads the core purpose without unnecessary words. It directly states what the tool does, making it easy to scan and understand quickly. Every part of the sentence earns its place by specifying key details like platforms and signing.

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 complexity of a build tool with no annotations and no output schema, the description is incomplete. It lacks information on behavioral traits (e.g., side effects, runtime), output details (e.g., where built files are saved), and usage context (e.g., dependencies or prerequisites). While concise, it doesn't provide enough context for an agent to confidently invoke this tool without additional assumptions.

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 already documents all parameters (cwd, platforms, obfuscate) with descriptions and defaults. The description adds no parameter-specific information beyond implying platforms via 'APK, AAB, IPA', which aligns with the schema's enum values. Since the schema does the heavy lifting, the baseline score of 3 is appropriate, as the description doesn't enhance parameter understanding.

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: 'Build release versions for all platforms: APK, AAB, IPA with signing'. It specifies the verb ('Build'), resource ('release versions'), and target platforms, distinguishing it from sibling tools like 'flutter_build' (which likely handles general builds) and 'flutter_run' (which runs apps). However, it doesn't explicitly differentiate from 'flutter_build' beyond mentioning release versions and signing, leaving some ambiguity.

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 mention prerequisites (e.g., requiring a Flutter project setup or signing keys), when not to use it (e.g., for debug builds), or direct alternatives among siblings like 'flutter_build'. This lack of context makes it unclear how to choose between this and other build-related tools.

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