Skip to main content
Glama

Type Text

mobile_type_keys
Destructive

Type text into focused elements on mobile devices for automation testing. Specify device identifier, text content, and submission option to simulate user input in iOS and Android applications.

Instructions

Type text into the focused element

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
deviceYesThe device identifier to use. Use mobile_list_available_devices to find which devices are available to you.
textYesThe text to type
submitYesWhether to submit the text. If true, the text will be submitted as if the user pressed the enter key.

Implementation Reference

  • src/server.ts:365-382 (registration)
    Registration of the 'mobile_type_keys' tool, including inline schema definition and handler function that uses the selected robot to send keys and optionally press ENTER.
    tool(
    	"mobile_type_keys",
    	"Type text into the focused element",
    	{
    		text: z.string().describe("The text to type"),
    		submit: z.boolean().describe("Whether to submit the text. If true, the text will be submitted as if the user pressed the enter key."),
    	},
    	async ({ text, submit }) => {
    		requireRobot();
    		await robot!.sendKeys(text);
    
    		if (submit) {
    			await robot!.pressButton("ENTER");
    		}
    
    		return `Typed text: ${text}`;
    	}
    );
  • Handler implementation for 'mobile_type_keys': requires a selected robot, sends the provided text via robot.sendKeys(), and if submit is true, presses the ENTER button.
    async ({ text, submit }) => {
    	requireRobot();
    	await robot!.sendKeys(text);
    
    	if (submit) {
    		await robot!.pressButton("ENTER");
    	}
    
    	return `Typed text: ${text}`;
    }
  • Zod schema for 'mobile_type_keys' tool parameters: text (required string), submit (boolean).
    text: z.string().describe("The text to type"),
    submit: z.boolean().describe("Whether to submit the text. If true, the text will be submitted as if the user pressed the enter key."),
  • Helper function 'tool()' used to register all tools, including error handling wrapper around the provided callback.
    const tool = (name: string, description: string, paramsSchema: ZodRawShape, cb: (args: z.objectOutputType<ZodRawShape, ZodTypeAny>) => Promise<string>) => {
    	const wrappedCb = async (args: ZodRawShape): Promise<CallToolResult> => {
    		try {
    			trace(`Invoking ${name} with args: ${JSON.stringify(args)}`);
    			const response = await cb(args);
    			trace(`=> ${response}`);
    			return {
    				content: [{ type: "text", text: response }],
    			};
    		} catch (error: any) {
    			if (error instanceof ActionableError) {
    				return {
    					content: [{ type: "text", text: `${error.message}. Please fix the issue and try again.` }],
    				};
    			} else {
    				// a real exception
    				trace(`Tool '${description}' failed: ${error.message} stack: ${error.stack}`);
    				return {
    					content: [{ type: "text", text: `Error: ${error.message}` }],
    					isError: true,
    				};
    			}
    		}
    	};
    
    	server.tool(name, description, paramsSchema, args => wrappedCb(args));

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed3 schema fields changedv1.0.0
    • removedInput schema / additionalProperties
      Removed value: -false
    • addedInput schema / properties / device
      Added value: +{
      +  "description": "The device identifier to use. Use mobile_list_available_devices to find which devices are available to you.",
      +  "type": "string"
      +}
    • changedInput schema / required
      Previous value: -[
      -  "text",
      -  "submit"
      -]New value: +[
      +  "device",
      +  "text",
      +  "submit"
      +]
  2. First observed

TDQS

A3.5/5.0
Behavior3/5

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

The annotation destructiveHint=true indicates the operation is potentially destructive, and the description adds the condition 'focused element' as the target. However, it does not explain side effects such as overwriting the current text, what happens if no element is focused, or the behavior when 'submit' is true (though this is partially covered in the schema).

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 sentence of six words, front-loading the core action and target. Every word contributes meaning; there is no fluff or repetition.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple typing tool, the description covers the basic operation and the schema covers parameters. However, it lacks usage context (e.g., when to use vs. alternatives, prerequisites like having a focused element clearly established) and does not compensate for the absence of an output schema with information about expected results or errors.

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 input schema provides full descriptions for all three parameters (text, device, submit), including guidance for finding available devices. The tool description itself adds no additional parameter semantics, so the schema's 100% coverage establishes a baseline of 3.

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 tool's function: 'Type text into the focused element.' The verb 'type' and the resource 'text into the focused element' distinguish it from sibling input tools like mobile_press_button or mobile_click_on_screen_at_coordinates, which involve different forms of interaction.

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 such as pressing a button or tapping coordinates. The only context is the parameter description for 'device' recommending mobile_list_available_devices, but this is not about tool selection or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.