Skip to main content
Glama
rahulkr
by rahulkr

clear_text_field

Remove text from Android device input fields by sending delete key commands. This tool helps clear text boxes during UI testing and development workflows.

Instructions

Clear text in current field by sending delete keys

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
lengthNo
device_serialNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The clear_text_field tool handler: moves cursor to end of field and sends multiple delete keyevents to clear up to the specified number of characters. Registered via @mcp.tool() decorator.
    @mcp.tool()
    def clear_text_field(length: int = 50, device_serial: str | None = None) -> str:
        """Clear text in current field by sending delete keys"""
        # Move to end and delete backwards
        run_adb(["shell", "input", "keyevent", "KEYCODE_MOVE_END"], device_serial)
        for _ in range(length):
            run_adb(["shell", "input", "keyevent", "KEYCODE_DEL"], device_serial)
        return f"Cleared up to {length} characters"
Behavior2/5

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

With no annotations, the description carries full burden but provides minimal behavioral insight. It mentions 'sending delete keys,' hinting at a simulated keypress action, but doesn't disclose critical traits like whether it requires UI focus, potential side effects (e.g., cursor movement), or error handling. For a tool with no annotations, this leaves significant gaps in understanding its operation.

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 that front-loads the core action ('clear text in current field') and method ('by sending delete keys'). There is no wasted verbiage, making it easy to parse quickly, though it could benefit from more detail given the lack of annotations.

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 of a UI interaction tool with no annotations and 0% schema coverage, the description is incomplete. It lacks details on behavior, parameters, and context (e.g., mobile testing environment). While an output schema exists (not provided here), the description doesn't address key aspects like success/failure states or integration with sibling tools, making it inadequate for informed use.

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 0%, so the description must compensate but adds no parameter information. It doesn't explain 'length' (number of delete keystrokes) or 'device_serial' (target device), leaving these entirely undocumented. However, with only 2 parameters and default values provided in the schema, the baseline is 3, as the description doesn't actively mislead but fails to add value.

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 ('clear text') and target ('current field'), specifying the method ('by sending delete keys'). It distinguishes from siblings like 'clear_app_data' or 'clear_logcat' by focusing on UI text fields. However, it doesn't explicitly mention the UI context (e.g., mobile app testing), leaving some ambiguity.

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 like 'input_text' (which might overwrite text) or manual deletion. The description implies usage for clearing text in a focused field, but lacks explicit context about prerequisites (e.g., needing a field selected) or comparisons to sibling tools.

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/rahulkr/r_adb_mcp_server'

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