Skip to main content
Glama

build_app

Build Kotlin Multiplatform Mobile applications for Android or iOS, returning structured results with error details to facilitate debugging and automated workflows.

Instructions

Build a KMM application for Android or iOS. Returns structured build result with error details on failure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
platformYesTarget platform to build for
variantNoBuild variant (default: debug)
cleanNoClean before building (default: false)
iosDestinationNoiOS simulator destination (e.g., "platform=iOS Simulator,name=iPhone 15 Pro")
androidModuleNoAndroid module name (default: androidApp)
iosSchemeNoiOS scheme name (default: iosApp)
timeoutMsNoBuild timeout in milliseconds (default: 30 minutes)

Implementation Reference

  • Main handler function for the 'build_app' tool. It validates the input arguments, determines the platform (Android or iOS), and delegates to the appropriate platform-specific build helper.
    export async function buildApp(args: BuildAppArgs): Promise<BuildResult> {
      const {
        platform,
        variant = 'debug',
        clean = false,
        iosDestination = 'platform=iOS Simulator,name=iPhone 15 Pro',
        androidModule = 'androidApp',
        iosScheme = 'iosApp',
        timeoutMs = DEFAULTS.BUILD_TIMEOUT_MS,
      } = args;
    
      // Validate platform
      if (!isPlatform(platform)) {
        throw Errors.invalidArguments(`Invalid platform: ${platform}. Must be 'android' or 'ios'`);
      }
    
      // Validate variant
      if (!isBuildVariant(variant)) {
        throw Errors.invalidArguments(`Invalid variant: ${variant}. Must be 'debug' or 'release'`);
      }
    
      // Build based on platform
      if (platform === 'android') {
        return buildAndroid({
          variant,
          clean,
          moduleName: androidModule,
          timeoutMs,
        });
      } else {
        return buildIOS({
          variant,
          clean,
          destination: iosDestination,
          scheme: iosScheme,
          timeoutMs,
        });
      }
    }
  • TypeScript interface defining the input arguments for the build_app tool, used for type safety and documentation.
    export interface BuildAppArgs {
      /** Target platform */
      platform: string;
      /** Build variant */
      variant?: string;
      /** Clean before build */
      clean?: boolean;
      /** iOS simulator destination */
      iosDestination?: string;
      /** Android module name */
      androidModule?: string;
      /** iOS scheme name */
      iosScheme?: string;
      /** Build timeout in milliseconds */
      timeoutMs?: number;
    }
  • Helper function that builds the Android app by invoking the Gradle build process.
    async function buildAndroid(options: {
      variant: BuildVariant;
      clean: boolean;
      moduleName: string;
      timeoutMs: number;
    }): Promise<BuildResult> {
      const gradleOptions: GradleBuildOptions = {
        variant: options.variant,
        clean: options.clean,
        moduleName: options.moduleName,
        timeoutMs: options.timeoutMs,
      };
    
      return buildGradle(gradleOptions);
    }
  • Helper function that builds the iOS app by invoking the Xcode build process, with availability check.
    async function buildIOS(options: {
      variant: BuildVariant;
      clean: boolean;
      destination: string;
      scheme: string;
      timeoutMs: number;
    }): Promise<BuildResult> {
      // Check if xcodebuild is available
      const available = await isXcodebuildAvailable();
      if (!available) {
        throw Errors.platformUnavailable('ios');
      }
    
      const xcodeOptions: XcodeBuildOptions = {
        variant: options.variant,
        clean: options.clean,
        destination: options.destination,
        scheme: options.scheme,
        timeoutMs: options.timeoutMs,
      };
    
      return buildXcode(xcodeOptions);
    }
  • Central registration during server startup: imports and invokes registerBuildAppTool to register the 'build_app' tool in the global registry.
    const { registerBuildAppTool } = await import('./build/build-app.js');
    const { registerInstallAppTool } = await import('./build/install-app.js');
    const { registerLaunchAppTool } = await import('./build/launch-app.js');
    
    registerBuildAppTool();
    registerInstallAppTool();
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions the return value ('structured build result with error details on failure'), which is useful, but lacks critical details: it doesn't specify if this is a long-running operation, whether it modifies project files, what permissions are needed, or potential side effects. For a build tool with zero 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.

Conciseness4/5

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

The description is two sentences, front-loaded with the core purpose and followed by return value details. It avoids redundancy and wastes no words, though it could be slightly more structured (e.g., separating behavioral notes).

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 complexity (7 parameters, build operation) and lack of annotations/output schema, the description is moderately complete. It covers the basic purpose and return format but misses behavioral context (e.g., execution time, file system impacts) and usage guidelines. For a tool with no output schema, mentioning the return structure is helpful but insufficient for full understanding.

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 all 7 parameters. The description adds no parameter-specific information beyond what's in the schema (e.g., it doesn't explain interactions between parameters like 'platform' and 'iosDestination'). Baseline 3 is appropriate when the schema does 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 action ('Build') and resource ('a KMM application for Android or iOS'), specifying the technology stack (KMM) and target platforms. It distinguishes from siblings like 'clean_project' or 'run_unit_tests' by focusing on compilation. However, it doesn't explicitly differentiate from similar build-related tools that might exist in other contexts, keeping it at 4 rather than 5.

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., project setup), when to choose specific platforms/variants, or how it relates to siblings like 'clean_project' or 'install_app'. This leaves the agent with minimal context for decision-making.

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/abd3lraouf/specter-mcp'

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