Skip to main content
Glama

input_text

Simulate text input on Android devices using ADB commands. Automate UI interactions by injecting text directly into active fields for testing and debugging purposes.

Instructions

Input text into the current field

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText to input

Implementation Reference

  • The core handler function for the 'input_text' tool. Escapes the input text, executes ADB commands to input the text and press ENTER, captures the updated UI hierarchy, and returns a formatted response with the action confirmation and UI dump.
    input_text: async (args: any) => { const { text } = args as { text: string }; const escapedText = text.replace(/"/g, '\\"'); await executeCommand(`adb shell input text "${escapedText}"`); await executeCommand(`adb shell input keyevent 66`); const uiContent = await captureUIContent(false); return { content: [ { type: 'text', text: `Text input: ${text}`, }, ...uiContent, ], }; },
  • The JSON schema definition for the 'input_text' tool, defining the required 'text' string parameter.
    { name: 'input_text', description: 'Input text into the current field', inputSchema: { type: 'object', properties: { text: { type: 'string', description: 'Text to input', }, }, required: ['text'], }, },
  • src/index.ts:26-30 (registration)
    Registration of tool list handler, which provides the schema definitions for all tools including 'input_text'.
    server.setRequestHandler(ListToolsRequestSchema, async () => { return { tools: toolDefinitions, }; });
  • src/index.ts:32-46 (registration)
    Registration of tool call handler, which dynamically dispatches to the 'input_text' handler based on tool name from the imported toolHandlers object.
    server.setRequestHandler(CallToolRequestSchema, async (request) => { const { name, arguments: args } = request.params; try { const handler = toolHandlers[name as keyof typeof toolHandlers]; if (!handler) { throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`); } return await handler(args); } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); throw new McpError(ErrorCode.InternalError, `Tool execution failed: ${errorMessage}`); } });

Other Tools

Related 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/TiagoDanin/Android-Debug-Bridge-MCP'

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