Skip to main content
Glama

Read the foreground Android app

mobile_app_foreground
Read-onlyIdempotent

Identify the app in the foreground on an Android display by returning its focused package and activity. Use for device inspection when you need to know which app is active.

Instructions

Return the focused package and activity for one logical display. Window focus is preferred; activity tops are the fallback.

Input Schema

NameRequiredDescriptionDefault
serialYesExact ADB serial from mobile_devices_list; never inferred when multiple devices exist
displayIdNoAndroid framework logical display ID, not a SurfaceFlinger physical ID

Output Schema

NameRequiredDescriptionDefault
serialYes
sourceYes
taskIdNo
activityNo
displayIdYes
packageNameNo
focusedWindowNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.9.0

TDQS

A3.8/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent and non-destructive, so the safety burden is covered. The description still adds genuine resolution semantics beyond the annotations: window focus is preferred and activity top is the fallback, telling the agent how the returned value is derived.

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?

Two tight sentences with the primary purpose front-loaded and the fallback behavior following. Every clause earns its place; no restatement of the title or schema.

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

Completeness4/5

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

With an output schema present and annotations covering safety, the description need not explain return shape. It covers purpose, scope and resolution precedence; the only minor gap is unspecified behavior when no window holds focus or when several displays exist.

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%, so both parameters are already documented (including the ADB serial caveat and the logical-display distinction). The description's 'one logical display' phrasing only echoes displayId without adding syntax or format detail, so the baseline 3 applies.

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?

States a specific verb ('Return') and resource ('focused package and activity') plus a scope qualifier ('for one logical display'). An agent can tell this reports foreground state, but the description never names a sibling (e.g. mobile_app_inspect, mobile_focus_trace) to differentiate against.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The use case is implied clearly enough by the description, but there is no explicit when-to-use, when-not, or alternative named among the many app/focus siblings. An agent must infer the routing on its own.

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