Skip to main content
Glama

android_sdk_setup

Configure Android SDK and development environment by checking, installing, or setting up required components for Android app development.

Instructions

Setup Android SDK and configure environment for Android development

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionNoAction to performcheck
componentsNoSDK components to install (platform-tools, build-tools, platforms, etc.)

Implementation Reference

  • The handler function implementing the core logic for the android_sdk_setup tool. It handles 'check', 'install' actions: checks SDK presence, locates sdkmanager, and installs specified components using sdkmanager.
    handler: async (args: any) => {
      const homeDir = os.homedir();
      const platform = process.platform;
      
      const androidPath = platform === 'darwin' 
        ? path.join(homeDir, 'Library', 'Android', 'sdk')
        : platform === 'win32'
        ? path.join(homeDir, 'AppData', 'Local', 'Android', 'Sdk')
        : path.join(homeDir, 'Android', 'Sdk');
    
      const results = {
        platform,
        androidPath,
        status: {} as any,
        installation: null as any,
        configuration: null as any
      };
    
      // Check current status
      if (args.action === 'check' || args.action === 'install') {
        try {
          await fs.access(androidPath);
          results.status.sdkFound = true;
          
          // Check for sdkmanager
          const sdkManagerPaths = [
            path.join(androidPath, 'cmdline-tools', 'latest', 'bin', 'sdkmanager'),
            path.join(androidPath, 'cmdline-tools', '17.0', 'bin', 'sdkmanager'),
            path.join(androidPath, 'tools', 'bin', 'sdkmanager')
          ];
          
          let sdkManagerPath = null;
          for (const path of sdkManagerPaths) {
            try {
              await fs.access(path);
              sdkManagerPath = path;
              break;
            } catch (e) {
              // Continue checking
            }
          }
          
          results.status.sdkManager = sdkManagerPath;
          
          if (sdkManagerPath && args.action === 'install') {
            // Install requested components
            results.installation = {
              components: args.components || [],
              results: []
            };
            
            for (const component of args.components || []) {
              try {
                await processExecutor.execute(sdkManagerPath, [
                  '--install',
                  component,
                  '--sdk_root=' + androidPath
                ], { timeout: 300000 });
                
                results.installation.results.push({
                  component,
                  status: 'success'
                });
              } catch (error) {
                results.installation.results.push({
                  component,
                  status: 'failed',
                  error: error instanceof Error ? error.message : String(error)
                });
              }
            }
          }
        } catch (e) {
          results.status.sdkFound = false;
          results.status.message = 'Android SDK not found. Install Android Studio or command-line tools.';
        }
      }
    
      return {
        success: true,
        data: results
      };
    }
  • JSON schema defining the input parameters for the android_sdk_setup tool, including action (check/install/configure) and components array.
    inputSchema: {
      type: 'object',
      properties: {
        action: {
          type: 'string',
          enum: ['check', 'install', 'configure'],
          description: 'Action to perform',
          default: 'check'
        },
        components: {
          type: 'array',
          items: {
            type: 'string'
          },
          description: 'SDK components to install (platform-tools, build-tools, platforms, etc.)',
          default: ['platform-tools', 'build-tools;34.0.0', 'platforms;android-34']
        }
      }
    },
  • Registration of the android_sdk_setup tool in the createSetupTools function's tools Map, including name, description, inputSchema, and handler.
    // Android SDK Setup Tool
    tools.set('android_sdk_setup', {
      name: 'android_sdk_setup',
      description: 'Setup Android SDK and configure environment for Android development',
      inputSchema: {
        type: 'object',
        properties: {
          action: {
            type: 'string',
            enum: ['check', 'install', 'configure'],
            description: 'Action to perform',
            default: 'check'
          },
          components: {
            type: 'array',
            items: {
              type: 'string'
            },
            description: 'SDK components to install (platform-tools, build-tools, platforms, etc.)',
            default: ['platform-tools', 'build-tools;34.0.0', 'platforms;android-34']
          }
        }
      },
      handler: async (args: any) => {
        const homeDir = os.homedir();
        const platform = process.platform;
        
        const androidPath = platform === 'darwin' 
          ? path.join(homeDir, 'Library', 'Android', 'sdk')
          : platform === 'win32'
          ? path.join(homeDir, 'AppData', 'Local', 'Android', 'Sdk')
          : path.join(homeDir, 'Android', 'Sdk');
    
        const results = {
          platform,
          androidPath,
          status: {} as any,
          installation: null as any,
          configuration: null as any
        };
    
        // Check current status
        if (args.action === 'check' || args.action === 'install') {
          try {
            await fs.access(androidPath);
            results.status.sdkFound = true;
            
            // Check for sdkmanager
            const sdkManagerPaths = [
              path.join(androidPath, 'cmdline-tools', 'latest', 'bin', 'sdkmanager'),
              path.join(androidPath, 'cmdline-tools', '17.0', 'bin', 'sdkmanager'),
              path.join(androidPath, 'tools', 'bin', 'sdkmanager')
            ];
            
            let sdkManagerPath = null;
            for (const path of sdkManagerPaths) {
              try {
                await fs.access(path);
                sdkManagerPath = path;
                break;
              } catch (e) {
                // Continue checking
              }
            }
            
            results.status.sdkManager = sdkManagerPath;
            
            if (sdkManagerPath && args.action === 'install') {
              // Install requested components
              results.installation = {
                components: args.components || [],
                results: []
              };
              
              for (const component of args.components || []) {
                try {
                  await processExecutor.execute(sdkManagerPath, [
                    '--install',
                    component,
                    '--sdk_root=' + androidPath
                  ], { timeout: 300000 });
                  
                  results.installation.results.push({
                    component,
                    status: 'success'
                  });
                } catch (error) {
                  results.installation.results.push({
                    component,
                    status: 'failed',
                    error: error instanceof Error ? error.message : String(error)
                  });
                }
              }
            }
          } catch (e) {
            results.status.sdkFound = false;
            results.status.message = 'Android SDK not found. Install Android Studio or command-line tools.';
          }
        }
    
        return {
          success: true,
          data: results
        };
      }
    });
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 states the tool sets up and configures the Android SDK, implying it may install software or modify system settings, but doesn't disclose critical details like whether it requires admin permissions, has side effects, is idempotent, or handles errors. This is inadequate for a tool that likely performs system-level operations.

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 a single, efficient sentence that front-loads the core purpose. It avoids unnecessary words, though it could be slightly more specific (e.g., mentioning typical use cases) to improve clarity without sacrificing brevity.

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 (likely involving system changes), lack of annotations, and no output schema, the description is insufficient. It doesn't explain what 'setup' entails (e.g., downloads, path configuration), potential outcomes, or error handling, leaving significant gaps for an agent to use it safely and effectively.

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 documentation for both parameters (action and components), including enums and defaults. The description adds no additional parameter semantics beyond what the schema provides, so it meets the baseline of 3 for high schema coverage without compensating value.

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 a specific verb ('Setup') and resource ('Android SDK'), and mentions configuring the environment for Android development. However, it doesn't explicitly differentiate from sibling tools like 'flutter_setup_environment' or 'android_create_avd', which reduces clarity about its unique scope.

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, timing (e.g., before other Android/Flutter tools), or exclusions, leaving the agent to infer usage from the tool name and context 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/cristianoaredes/mcp-mobile-server'

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