Skip to main content
Glama

Build and run

build_and_run
Destructive

Builds an Android project with Gradle (default assembleDebug), installs the generated APK on the device, and launches the specified package in one blocking call.

Instructions

One-shot build → install → launch: runs Gradle (default task assembleDebug) in project_dir, installs the resulting APK on the device, and launches package. Equivalent to gradle_build + install_app + launch_app in a single call, and it blocks for the whole build. A failed build returns the same summary and full-log path as gradle_build. If several APKs exist under build/outputs (multi-flavor projects, leftover androidTest APKs), the newest non-test one is installed.

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": {
      "package": "<package>"
    },
    "name": "build_and_run"
  }
}

Input Schema

NameRequiredDescriptionDefault
argsNoExtra arguments passed to Gradle (e.g. --stacktrace, -Pflavor=free).
taskNoGradle task to run. Defaults to assembleDebug.
serialNoTarget device serial (adb -s). Optional when exactly one device is attached.
packageYesApplication package name to install and launch, e.g. com.example.app.
project_dirNoPath to the Android project root containing the Gradle wrapper (gradlew). Optional if session_set_defaults has pinned a project_dir for this session.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A4.2/5.0
Behavior4/5

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

With destructiveHint=true and openWorldHint=true already supplied, the description still earns credit by disclosing blocking semantics, failure return shape (same summary and full-log path as gradle_build), and the APK-selection heuristic for multi-flavor/leftover androidTest outputs. It does not disclose the destructive consequence itself — that installing overwrites the existing app and can wipe app data — nor that a blocking call cannot be interrupted, which is exactly the context the destructiveHint raises.

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?

Front-loaded with the pipeline and the sibling equivalence, then progressively narrower details (blocking, failure behavior, APK selection) in descending order of importance. No sentence is filler and the parenthetical flavor/androidTest caveat is exactly the edge case an agent would otherwise get wrong.

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 5-parameter mutating pipeline with no output schema, the description covers what it does, that it blocks, what happens on failure, and how the target APK is chosen — enough to invoke correctly. The remaining gap is the outcome of the launch step (does it return the launched activity/package, and does a launch failure differ from a build failure), which an agent would want before relying on 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% and every parameter already carries a description, so the schema does the heavy lifting. The description restates the assembleDebug default for task and the project_dir usage but adds no syntax, format or interaction detail (e.g. how args combine with task, or serial precedence) beyond what the schema says. Baseline 3 is appropriate.

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?

"One-shot build → install → launch" states a specific compound verb chain and the resources it touches (Gradle task, APK, package). It explicitly distinguishes itself from siblings gradle_build, install_app and launch_app by declaring itself their equivalent in a single call, so an agent can route without opening a schema.

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?

The equivalence statement plus "blocks for the whole build" gives a clear condition for choosing this over the three separate tools (one-shot convenience, at the cost of blocking). What's missing is the inverse case: nothing tells the agent when NOT to use it, e.g. to prefer gradle_build when it wants build_status or cancel_build on a long build, both of which exist as siblings.

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