Skip to main content
Glama

adb_input_text

Send text input to Android devices via ADB commands for automation testing and device control.

Instructions

Input text on the device

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText to input
deviceIdNoDevice ID (optional)

Implementation Reference

  • Core handler function in ScreenTools class that validates input, checks device connection, escapes text for shell, and executes the ADB 'input text' command.
    async inputText(options: InputTextOptions) {
      try {
        const { text, deviceId } = options;
        
        if (!text || text.trim().length === 0) {
          return {
            success: false,
            error: 'Empty text',
            message: 'Text cannot be empty'
          };
        }
    
        const connected = await this.adbClient.isDeviceConnected(deviceId);
        if (!connected) {
          return {
            success: false,
            error: 'Device not connected',
            message: 'Cannot input text - device is not connected'
          };
        }
    
        // Escape special characters for shell
        const escapedText = text.replace(/["\\\s]/g, '\\$&');
        const command = `shell input text "${escapedText}"`;
        const result = await this.adbClient.executeCommand(command, deviceId);
        
        if (!result.success) {
          return {
            success: false,
            error: result.error,
            message: 'Failed to input text'
          };
        }
    
        return {
          success: true,
          data: { 
            text,
            deviceId: deviceId || this.adbClient.getDefaultDevice()
          },
          message: `Input text: "${text}"`
        };
      } catch (error: any) {
        return {
          success: false,
          error: error.message,
          message: 'Failed to input text'
        };
      }
    }
  • Tool registration in ListTools handler including name, description, and input schema definition.
    {
      name: 'adb_input_text',
      description: 'Input text on the device',
      inputSchema: {
        type: 'object',
        properties: {
          text: {
            type: 'string',
            description: 'Text to input',
          },
          deviceId: {
            type: 'string',
            description: 'Device ID (optional)',
          },
        },
        required: ['text'],
      },
  • src/index.ts:447-448 (registration)
    Switch case in CallToolRequestSchema handler that routes 'adb_input_text' calls to ScreenTools.inputText method.
    case 'adb_input_text':
      return await this.handleToolCall(this.screenTools.inputText(args as any));
  • TypeScript interface defining the input parameters for the adb_input_text tool, used in ScreenTools.inputText.
    export interface InputTextOptions {
      deviceId?: string;
      text: string;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden. It mentions 'input text' but doesn't disclose behavioral traits like whether this simulates keyboard typing, requires device interaction, has side effects (e.g., triggering actions), or error conditions. This is inadequate for a mutation tool with zero annotation coverage.

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 with zero waste. It's appropriately sized for a simple tool, though it could be more informative without losing conciseness. No structural issues are present.

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 (a mutation tool with no annotations and no output schema), the description is incomplete. It doesn't cover what the tool returns, error handling, or prerequisites (e.g., device connectivity). For a tool that likely modifies device state, more 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?

Schema description coverage is 100%, with clear parameter descriptions in the schema. The description adds no meaning beyond the schema—it doesn't explain parameter interactions (e.g., how deviceId defaults if omitted) or usage nuances. Baseline 3 is appropriate as the schema does the heavy lifting.

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 'Input text on the device' clearly states the action (input) and target (device), but it's vague about the mechanism and doesn't distinguish from siblings like adb_shell (which could also input text) or adb_press_key (which inputs keystrokes). It's better than a tautology but lacks specificity.

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 on when to use this tool versus alternatives. For example, it doesn't specify if this is for typing text in UI fields versus command-line input, or when to prefer adb_shell for text input. The description offers no context for selection among siblings.

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/richard0913/adb-mcp'

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