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));
Behavior3/5

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

The annotation destructiveHint=true already indicates this is a mutation operation. The description adds minimal behavioral context by specifying 'into the focused element,' which clarifies the target but doesn't elaborate on side effects, error conditions, or interaction patterns. No contradiction with annotations exists.

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 action and target, making it easy to parse quickly without unnecessary elaboration.

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?

Given the tool's moderate complexity (3 required parameters, destructive operation, no output schema), the description is minimally adequate. It covers the basic action but lacks details on error handling, what 'focused element' means contextually, or how it integrates with other mobile interaction tools, leaving gaps for an agent to infer usage.

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 documentation for all three parameters (device, text, submit). The description adds no additional parameter semantics beyond what the schema provides, such as examples or edge cases, so it meets the baseline for high schema coverage.

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

Purpose4/5

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

The description clearly states the action ('Type text') and target ('into the focused element'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like mobile_press_button or mobile_click_on_screen_at_coordinates, which might also input text in different ways.

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 a focused element), exclusions, or comparisons to sibling tools like mobile_press_button for submitting forms or mobile_click_on_screen_at_coordinates for interacting with specific UI elements.

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/EmpathySlainLovers/MCP'

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