Skip to main content
Glama

android_input_text

Input text into focused fields on Android devices using ADB commands. This tool enables automated text entry for testing or automation workflows.

Instructions

Input text into the currently focused field on the Android device via ADB

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText to input. Spaces will be automatically handled.
deviceSerialNoSpecific device serial number to target (optional)

Implementation Reference

  • src/index.ts:416-433 (registration)
    Registration of the 'android_input_text' tool including name, description, and input schema definition.
    {
      name: 'android_input_text',
      description: 'Input text into the currently focused field on the Android device via ADB',
      inputSchema: {
        type: 'object',
        properties: {
          text: {
            type: 'string',
            description: 'Text to input. Spaces will be automatically handled.',
          },
          deviceSerial: {
            type: 'string',
            description: 'Specific device serial number to target (optional)',
          },
        },
        required: ['text'],
      },
    },
  • src/index.ts:504-505 (registration)
    Dispatch case in the MCP tool handler switch statement that routes 'android_input_text' calls to the handleInputText function.
    case 'android_input_text':
      return await handleInputText(this.adb, args as any);
  • Main handler function for the 'android_input_text' tool. Extracts arguments, calls the ADB wrapper's inputText method, and returns a success response.
    export async function handleInputText(adb: ADBWrapper, args: InputTextArgs): Promise<{ content: Array<{ type: string; text: string }> }> {
      const { text, deviceSerial } = args;
    
      try {
        await adb.inputText(text, deviceSerial);
        return {
          content: [
            {
              type: 'text',
              text: `Text input sent: "${text}"`,
            },
          ],
        };
      } catch (error) {
        throw new Error(`Failed to input text: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • TypeScript interface defining the input arguments for the android_input_text handler.
    interface InputTextArgs {
      text: string;
      deviceSerial?: string;
    }
  • Core implementation in ADB wrapper that executes the 'adb shell input text' command with space escaping (%s), performing the actual text input on the Android device.
    async inputText(text: string, deviceSerial?: string): Promise<void> {
      const device = await this.getTargetDevice(deviceSerial);
      // Escape spaces and special characters
      const escapedText = text.replace(/ /g, '%s');
      await this.exec(['shell', 'input', 'text', escapedText], device);
    }
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. While it mentions the action and method (ADB), it lacks critical behavioral details such as whether this requires device accessibility permissions, what happens if no field is focused, error conditions, or performance characteristics. The description is minimal and doesn't adequately cover behavioral traits.

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 front-loaded with the core purpose and includes essential context about the method (ADB). Every element of the description serves a clear purpose.

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 device interaction tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens on success/failure, return values, error conditions, or prerequisites (like needing ADB setup or device accessibility enabled). The description leaves too many operational questions unanswered.

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 fully documents both parameters. The description doesn't add any parameter-specific information beyond what's in the schema (e.g., it doesn't explain text encoding, special character handling, or device selection logic). Baseline 3 is appropriate when schema does the heavy lifting.

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

Purpose5/5

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

The description clearly states the specific action ('Input text'), target resource ('currently focused field on the Android device'), and method ('via ADB'). It distinguishes itself from sibling tools like android_uiautomator_set_text by specifying it works on the currently focused field rather than requiring UI element targeting.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context ('currently focused field') which suggests when to use this tool versus alternatives like android_uiautomator_set_text that require element identification. However, it doesn't explicitly state when NOT to use it or name specific alternative tools, leaving some ambiguity about tool selection.

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/jduartedj/android-mcp-server'

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