Skip to main content
Glama

Set battery

set_battery
Idempotent

Set an Android device's battery level and charging state to test low-battery or charging-only UI deterministically; reset to restore automatic reporting.

Instructions

Set the battery level (0-100) and/or charging state — test low-battery UI and charging-only logic deterministically. On an emulator it uses the console (adb emu power); on a PHYSICAL device it forces the values via dumpsys battery, which persist until you call this again with reset=true (or the device reboots). Provide level, charging, or both — or reset=true to restore automatic reporting. (For a fake battery in a clean SCREENSHOT status bar only, use set_status_bar instead.)

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": "set_battery"
  }
}

Input Schema

NameRequiredDescriptionDefault
levelNoBattery charge level 0-100. Omit to leave the level unchanged.
resetNoRestore automatic battery reporting (dumpsys battery reset) and ignore level/charging. On a physical device the forced values persist until this (or a reboot); use it to clean up after testing.
serialNoTarget device serial (adb -s). Optional when exactly one device is attached.
chargingNotrue = plugged into AC, false = on battery. Omit to leave the charging state unchanged.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.6/5.0
Behavior5/5

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

Annotations only declare idempotent/non-destructive/openWorld, so the description carries the real burden and does: it discloses the emulator-vs-physical-device implementation difference (adb emu power vs dumpsys battery), that forced values persist until reset or reboot, and that reset restores automatic reporting. That is exactly the persistence/cleanup context an agent needs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Dense but front-loaded: the purpose and effect land in the first clause, with persistence and the sibling alternative following. The nested parenthetical at the end is slightly heavy, but every sentence carries usable information.

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?

No output schema exists, yet the description covers state persistence, cross-platform behavior differences, the reset cleanup path, and the sibling alternative — sufficient for an agent to call it correctly and undo it.

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 coverage is 100%, so the schema already explains level, charging, reset, and serial including the 'omit to leave unchanged' semantics. The description reinforces the level/charging/both combination and reset precedence but adds little syntax or meaning beyond the structured fields, so 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?

Names a specific verb and resource (set battery level and/or charging state) and immediately states the purpose — deterministic low-battery/charging logic testing. It explicitly distinguishes itself from the sibling set_status_bar for the screenshot-only case.

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?

States exactly how to invoke it (level, charging, or both; or reset=true) and names the alternative (set_status_bar) with the condition that selects it. It also covers the cleanup path via reset, which is the key usage rule for a persisting mutation.

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