Skip to main content
Glama

Get foreground app

foreground
Read-onlyIdempotent

Return which app currently has focus on an Android device as a package/activity string, so you can confirm the open app before reading or tapping.

Instructions

Return which app has focus on the device, as a "package/activity" string such as "org.mozilla.firefox/.App". Use it to confirm which app is open before reading or tapping; use snapshot instead to see what is on screen. Read-only. Fails if the device is not connected and authorized, the serial is out of scope, or Android exposes no focused window (for example while the screen is locked).

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "foreground"
  }
}

Input Schema

NameRequiredDescriptionDefault
serialNoADB serial of the target device, as returned by list_devices. Required when the server has no --device scope; when scoped, omit it or pass the same serial (any other serial is rejected).

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.1.1
    • addedInput schema / properties / serial / description
      Added value: +"ADB serial of the target device, as returned by list_devices. Required when the server has no --device scope; when scoped, omit it or pass the same serial (any other serial is rejected)."
  2. First observedv0.1.0

TDQS

A4.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint and destructiveHint=false, yet the description still adds real value by enumerating failure conditions: device not connected and authorized, serial out of scope, and no focused window (screen locked). The only remaining gap is ambiguity on multi-window cases such as split-screen, where 'which app has focus' could be non-obvious.

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 purpose and output format are front-loaded in the first sentence, the usage routing second, and constraints last. Every sentence carries distinct information — return format, sibling routing, safety profile, failure modes — with no restatement of the name or title.

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

Completeness5/5

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

For a single-optional-parameter read tool with annotations and an output schema, this is complete: return format, selection guidance, and failure modes are all covered, and no explanation of response structure is required given the output schema.

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% and the single 'serial' parameter is fully documented in the schema, including the scoping rule and rejection behavior. The description adds nothing about the parameter, so the baseline 3 applies.

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?

States a specific verb and resource ('Return which app has focus on the device') and pins down the exact return shape via the concrete example 'org.mozilla.firefox/.App'. It also names the sibling it is not — 'use snapshot instead to see what is on screen' — so an agent can pick between them without opening either schema.

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

Usage Guidelines5/5

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

Explicit when-to-use guidance ('confirm which app is open before reading or tapping') is paired with an explicit alternative and the condition that selects it ('use snapshot instead to see what is on screen'). Nothing about routing between the two relevant siblings is left to inference.

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

Deploy Server

Other Tools