Skip to main content
Glama

Set device lock

set_device_lock
Destructive

Sets a PIN, pattern, or password lock screen on an Android device so Keystore-backed crypto flows can run on a fresh emulator that lacks a secure lock.

Instructions

Set a secure lock screen (type: pin [default], pattern, or password). REQUIRED before AndroidKeyStore / Keystore-backed crypto flows, which fail with 'A secure lock screen is required' on a fresh emulator that has no lock. Follow with is_device_secure to confirm.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "value": "<value>"
    },
    "name": "set_device_lock"
  }
}

Input Schema

NameRequiredDescriptionDefault
typeNoLock type: pin (default), pattern, or password.
valueYesCredential to set, e.g. "1234".
serialNoTarget device serial (adb -s). Optional when exactly one device is attached.
old_valueNoThe CURRENT credential, required only when a lock is already set and you want to change it (locksettings refuses to overwrite otherwise).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.1/5.0
Behavior4/5

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

Annotations already flag destructiveHint=true and openWorldHint=false, and the description adds real context beyond that: the downstream failure mode ("A secure lock screen is required"), the fresh-emulator scenario, and the fact that locksettings refuses to overwrite an existing credential without old_value. It does not say whether an existing lock is replaced or whether anything on the device is reset, which is the main remaining behavioral gap.

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?

Three tight sentences, front-loaded with the action and its parameter default, then the reason to call it, then the verification step. No filler or repetition of the 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?

For a four-parameter mutation with no output schema, the description supplies the motive for calling it, the prerequisite, and the verification path, which is enough to invoke it correctly. The only gap is the effect on an already-configured device, which the old_value note only partially covers.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the schema already documents all four parameters; the description only restates the type enum and default. It does reinforce the old_value precondition by explaining the underlying refusal to overwrite, but adds little syntax or format detail beyond the schema.

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 and resource ("Set a secure lock screen") and enumerates the accepted credential types with the default called out. It never names the obvious siblings (clear_device_lock, enter_pin, prefer_pin), so an agent must infer the boundary, which keeps it short of a 5.

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

Usage Guidelines4/5

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

Gives a concrete precondition for use ("REQUIRED before AndroidKeyStore / Keystore-backed crypto flows") and a follow-up step ("Follow with is_device_secure to confirm"). It does not state when not to use it or how it differs from clear_device_lock / enter_pin, so exclusions are absent.

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