Skip to main content
Glama

Run a project's tests

android_test

Run Gradle tests and report failures. Executes unit or instrumented tests, returning failing test names and condensed output for quick verification.

Instructions

Run a Gradle project's tests and report which ones failed.

This is the verification half of the loop: after changing code, prove the change works rather than assuming it. Failure output is condensed the same way android_build condenses it — you get the failing test names, not the whole Gradle log.

Two kinds of test:

  • 'unit' runs testDebugUnitTest on the JVM. Fast, no device needed.

  • 'instrumented' runs connectedDebugAndroidTest on a connected device or emulator. Slower, and requires a device.

Args:

  • project_path (string): absolute path to the Gradle root (contains gradlew)

  • module (string): module whose tests to run (default: 'app')

  • kind ('unit' | 'instrumented'): which test task to run (default: 'unit')

  • tests (string, optional): Gradle --tests filter, e.g. "com.example.MyTest" or ".LoginTest."

  • timeout_ms (number): timeout (default: 900000)

  • force (boolean): skip the JDK/Gradle compatibility pre-check (default: false)

  • response_format ('markdown' | 'json')

Returns: { "success": boolean, "task": string, // e.g. ":app:testDebugUnitTest" "durationMs": number, "failures": string[], // failing test names, when parseable "output": string, // condensed failure summary, or the tail on success "hint": string // present when the failure is a known one }

Examples:

  • Use when: you changed logic and want to know it still passes -> kind="unit"

  • Use when: narrowing to one failing test -> tests="com.example.CalcTest"

  • Use when: the behaviour only shows on a device -> kind="instrumented"

  • Don't use when: you only need the app compiled (use android_build)

Error Handling:

  • "instrumented" with no device connected fails at the device check, before Gradle starts

  • A project with no test sources reports success with an up-to-date task rather than a failure

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kindNo'unit' runs on the JVM; 'instrumented' runs on a connected device.unit
forceNoSkip the JDK/Gradle compatibility pre-check.
testsNoGradle --tests filter, e.g. 'com.example.MyTest' or '*.LoginTest.*'.
moduleNoGradle module that produces the APK. Almost always 'app'.app
timeout_msNoTimeout in milliseconds.
project_pathYesAbsolute path to the Gradle project root — the directory containing gradlew and settings.gradle.
response_formatNoOutput format: 'markdown' for human-readable, 'json' for machine-readable.markdown
Behavior5/5

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

The description goes beyond annotations by disclosing output condensing, device requirements for instrumented tests, behavior when no test sources exist (success with up-to-date task), and the JDK/Gradle pre-check. All of these are non-obvious behaviors not captured in the annotations or schema. No contradiction exists.

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 description is dense but well-organized: a purpose sentence, verification role, test kind explanation, Args list, Return type, usage examples, and error handling. Every section earns its place given the tool's complexity and 7 parameters. No filler or repetition.

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?

Despite lacking an output schema, the description provides a full return structure JSON, covers error cases, explains the two test kinds, and mentions the pre-check. This is complete for the tool's complexity. The agent can act with confidence.

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?

The schema already covers 100% of parameters with descriptions, so the baseline is 3. The description adds value by restating parameters in a compact Args list with additional context: examples for the tests filter, the meaning of project_path (contains gradlew), and the default module 'app'. This clarifies semantics beyond the schema, earning a 4.

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?

The description opens with a specific verb+resource: 'Run a Gradle project's tests and report which ones failed.' It clearly distinguishes itself from siblings by explicitly naming android_build as the alternative for compilation-only needs. The scope is unambiguous.

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?

The 'Examples' section provides explicit 'Use when' conditions for both unit and instrumented tests, as well as a 'Don't use when' that names android_build. This gives the agent clear decision rules for tool selection, going well beyond generic hints.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/jjs03111/android-build-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server