Skip to main content
Glama
zillow
by zillow

imeAction

Execute IME actions like done, next, search, send, go, or previous on Android and iOS devices for mobile automation testing.

Instructions

Perform an IME action (e.g., done, next, search)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesIME action to perform
platformYesPlatform of the device

Implementation Reference

  • Main handler logic for executing IME actions, including validation, ADB keyevent execution, and screen change observation.
    async execute(
      action: "done" | "next" | "search" | "send" | "go" | "previous",
      progress?: ProgressCallback
    ): Promise<ImeActionResult> {
      // Validate action input
      if (!action) {
        return {
          success: false,
          action: "",
          error: "No IME action provided"
        };
      }
    
      return this.observedInteraction(
        async () => {
          try {
            await this.executeImeAction(action);
    
            return {
              success: true,
              action
            };
          } catch (error) {
            const errorMessage = error instanceof Error ? error.message : String(error);
    
            return {
              success: false,
              action,
              error: `Failed to execute IME action: ${errorMessage}`
            };
          }
        },
        {
          changeExpected: true,
          tolerancePercent: 0.00,
          timeoutMs: 3000, // IME actions should be quick
          progress
        }
      );
    }
  • Private helper that maps IME actions to Android keycodes and dispatches them via adb shell input keyevent.
    private async executeImeAction(imeAction: string): Promise<void> {
      logger.info("Executing IME action", { action: imeAction });
    
      // Map IME actions to Android key codes
      const imeKeyCodeMap: { [key: string]: string } = {
        "done": "KEYCODE_ENTER",
        "next": "KEYCODE_TAB",
        "search": "KEYCODE_SEARCH",
        "send": "KEYCODE_ENTER",
        "go": "KEYCODE_ENTER",
        "previous": "KEYCODE_SHIFT_LEFT KEYCODE_TAB" // Shift+Tab for previous
      };
    
      const keyCode = imeKeyCodeMap[imeAction];
      if (!keyCode) {
        throw new Error(`Unsupported IME action: ${imeAction}`);
      }
    
      // Small delay to ensure any preceding text input is processed
      await new Promise(resolve => setTimeout(resolve, 100));
    
      // Execute the key event(s)
      if (keyCode.includes(" ")) {
        // Handle multiple key combinations like Shift+Tab
        const keys = keyCode.split(" ");
        for (const key of keys) {
          await this.adb.executeCommand(`shell input keyevent ${key}`);
        }
      } else {
        await this.adb.executeCommand(`shell input keyevent ${keyCode}`);
      }
    }
  • MCP tool handler wrapper that instantiates ImeAction class and invokes its execute method.
    const imeActionHandler = async (device: BootedDevice, args: ImeActionArgs, progress?: ProgressCallback) => {
      try {
        const imeAction = new ImeAction(device);
        const result = await imeAction.execute(args.action, progress);
    
        return createJSONToolResponse({
          message: `Executed IME action "${args.action}"`,
          observation: result.observation,
          ...result
        });
      } catch (error) {
        throw new ActionableError(`Failed to execute IME action: ${error}`);
      }
    };
  • Zod input schema defining the arguments for the imeAction tool: action enum and platform.
    export const imeActionSchema = z.object({
      action: z.enum(["done", "next", "search", "send", "go", "previous"]).describe("IME action to perform"),
      platform: z.enum(["android", "ios"]).describe("Platform of the device")
    });
  • Registration of the imeAction tool in the ToolRegistry with name, description, schema, and handler.
    ToolRegistry.registerDeviceAware(
      "imeAction",
      "Perform an IME action (e.g., done, next, search)",
      imeActionSchema,
      imeActionHandler,
      true // Supports progress notifications
    );
  • TypeScript interface defining the return type of the ImeAction execution.
    export interface ImeActionResult {
        success: boolean;
        action: string;
        error?: string;
        observation?: any;
    }
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 performs an action but doesn't describe what happens (e.g., whether it triggers UI changes, requires specific device states, or has side effects like closing keyboards). For a tool with potential mutation effects and no annotation coverage, this is a significant gap in transparency.

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 ('Perform an IME action') and includes relevant examples. There's no wasted text, making it easy to parse, though it could be slightly more structured (e.g., by clarifying the IME context upfront).

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 IME actions (likely involving device input handling), no annotations, and no output schema, the description is incomplete. It doesn't explain what IME stands for, the expected outcomes, error conditions, or how it integrates with sibling tools. For a 2-parameter tool with potential behavioral nuances, more context is needed to guide 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%, with both parameters ('action' and 'platform') fully documented in the schema via enums and descriptions. The description adds no additional parameter semantics beyond the examples in parentheses, which align with the enum values. Given high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but doesn't detract either.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool 'Perform[s] an IME action' with examples (done, next, search), which provides a basic verb+resource understanding. However, it's vague about what IME actions are and doesn't distinguish this tool from sibling tools like 'pressKey' or 'inputText' that might handle similar input scenarios. The purpose is understandable but lacks specificity about the IME 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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an active IME context), exclusions, or how it differs from sibling tools like 'pressKey' for keyboard actions. Usage is implied through examples but not explicitly defined, leaving the agent to infer context.

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/zillow/auto-mobile'

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