Skip to main content
Glama

flutter_launch_emulator

Launch a Flutter emulator by specifying its ID to test mobile applications during development.

Instructions

Launch a Flutter emulator

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
emulatorIdYesEmulator ID to launch

Implementation Reference

  • Handler function that launches the specified Flutter emulator by executing the 'flutter emulators --launch [emulatorId]' command after validating the input.
    handler: async (args: any) => {
      const validation = FlutterEmulatorLaunchSchema.safeParse(args);
      if (!validation.success) {
        throw new Error(`Invalid request: ${validation.error.message}`);
      }
    
      const { emulatorId } = validation.data;
    
      // Validate emulator ID format (alphanumeric, underscores, dots, dashes)
      if (!/^[a-zA-Z0-9._-]+$/.test(emulatorId)) {
        throw new Error(`Invalid emulator ID format. Emulator ID can only contain alphanumeric characters, dots, underscores, and dashes: ${emulatorId}`);
      }
    
      const result = await processExecutor.execute(
        'flutter', 
        ['emulators', '--launch', emulatorId],
        { timeout: 180000 } // 3 minutes timeout for emulator launch
      );
    
      if (result.exitCode !== 0) {
        throw new Error(`Failed to launch emulator: ${result.stderr || result.stdout}`);
      }
    
      return {
        success: true,
        data: {
          emulatorId,
          status: 'launched',
          output: result.stdout,
        },
      };
    }
  • Zod validation schema defining the input parameters for the flutter_launch_emulator tool (emulatorId: string).
    const FlutterEmulatorLaunchSchema = z.object({
      emulatorId: z.string().min(1),
    });
  • Registration of the flutter_launch_emulator tool in the createFlutterTools function, including name, description, inputSchema, and reference to the handler.
    tools.set('flutter_launch_emulator', {
      name: 'flutter_launch_emulator',
      description: 'Launch a Flutter emulator',
      inputSchema: {
        type: 'object',
        properties: {
          emulatorId: { type: 'string', minLength: 1, description: 'Emulator ID to launch' }
        },
        required: ['emulatorId']
      },
      handler: async (args: any) => {
        const validation = FlutterEmulatorLaunchSchema.safeParse(args);
        if (!validation.success) {
          throw new Error(`Invalid request: ${validation.error.message}`);
        }
    
        const { emulatorId } = validation.data;
    
        // Validate emulator ID format (alphanumeric, underscores, dots, dashes)
        if (!/^[a-zA-Z0-9._-]+$/.test(emulatorId)) {
          throw new Error(`Invalid emulator ID format. Emulator ID can only contain alphanumeric characters, dots, underscores, and dashes: ${emulatorId}`);
        }
    
        const result = await processExecutor.execute(
          'flutter', 
          ['emulators', '--launch', emulatorId],
          { timeout: 180000 } // 3 minutes timeout for emulator launch
        );
    
        if (result.exitCode !== 0) {
          throw new Error(`Failed to launch emulator: ${result.stderr || result.stdout}`);
        }
    
        return {
          success: true,
          data: {
            emulatorId,
            status: 'launched',
            output: result.stdout,
          },
        };
      }
    });
  • JSON schema used for MCP tool input validation, mirroring the Zod schema.
    inputSchema: {
      type: 'object',
      properties: {
        emulatorId: { type: 'string', minLength: 1, description: 'Emulator ID to launch' }
      },
      required: ['emulatorId']
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('launch') but doesn't describe what happens during launch (e.g., startup time, potential errors, whether it's blocking/non-blocking), what permissions are needed, or what happens if the emulator is already running. This leaves significant gaps for a tool that performs a system operation.

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 with zero wasted words. It's appropriately sized for a simple tool with one parameter and gets straight to the point without unnecessary elaboration.

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?

For a tool that launches system emulators with no annotations and no output schema, the description is insufficient. It doesn't explain what constitutes a successful launch, what errors might occur, whether the tool waits for emulator readiness, or what the expected outcome should be. Given the complexity of emulator operations and lack of structured metadata, more behavioral context is needed.

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?

The schema has 100% description coverage, with the single parameter 'emulatorId' clearly documented in the schema. The description doesn't add any additional parameter context beyond what's already in the schema, so it meets the baseline for high schema coverage.

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 ('launch') and target ('Flutter emulator'), providing a specific verb+resource combination. However, it doesn't distinguish this tool from the sibling 'android_start_emulator' or explain the difference between Flutter and Android emulators in this context.

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?

No guidance is provided about when to use this tool versus alternatives like 'android_start_emulator' or 'flutter_run'. The description doesn't mention prerequisites (e.g., needing an emulator ID from 'flutter_list_devices' or 'android_list_emulators') or contextual constraints.

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