Skip to main content
Glama

List gradle variants

list_gradle_variants
Destructive

List an Android project's buildable Gradle variants so you can pass the right assemble or install task to builds and runs; test-only APK tasks are excluded. Scope to a module via :app:tasks.

Instructions

List the buildable build variants in project_dir (parsed from the assemble* tasks) — the Android analogue of "list schemes". Each variant V maps to an assembleV / installV Gradle task; pass it as the task= arg to gradle_build/build_and_run to disambiguate a multi-flavor project. Test-only APK tasks (androidTest/unitTest) are excluded. In a multi-module build the ROOT project usually has no variants of its own (no Android plugin applied there) — pass task=":tasks" (e.g. ":app:tasks", from list_gradle_projects) to scope to the module that actually builds APKs.

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

Input Schema

NameRequiredDescriptionDefault
taskNoGradle task to scope to, e.g. ":app:tasks" to list the :app module's tasks or variants. Defaults to the root project's tasks.
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. Changed1 schema field changedv0.24.3
    • changedInput schema / properties / task / description
      Previous value: -"Gradle task to scope to, e.g. \":app:tasks\" to list variants for the :app module. Defaults to the root project's tasks."New value: +"Gradle task to scope to, e.g. \":app:tasks\" to list the :app module's tasks or variants. Defaults to the root project's tasks."
  2. First observedv1.0.0

TDQS

A4.1/5.0
Behavior2/5

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

Annotations declare openWorldHint=true and destructiveHint=true, but the description frames the operation purely as a read ('List', 'parsed from'), never explaining that the call actually invokes Gradle configuration or that it can mutate/download anything. It does partially reconcile openWorldHint by revealing the assemble* task parsing, but the read-only framing versus a destructive annotation is an unreconciled inconsistency an agent needs to know about before invoking it.

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?

Front-loaded with the core action and scope, then the mapping and the multi-module caveat in descending priority. The em-dash parentheticals and the long final sentence are dense but each clause carries information an agent needs; nothing is filler.

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?

With only two optional parameters, no output schema, and a sparse annotation set, the description covers the domain-specific gotchas (test task exclusion, root-vs-module scoping) that actually cause failures. What is missing is the return shape (variant names vs. task names) and the fact that the call may run Gradle, leaving some gap against the destructive/open-world annotations.

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 baseline is 3, and the description exceeds it: it explains that each variant V maps to assembleV/installV, that the value must be passed as task= to gradle_build/build_and_run, and that task="<module>:tasks" (e.g. ":app:tasks") is the form to use for multi-module projects. That adds meaning beyond the schema's generic 'Gradle task to scope to'.

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 ('List the buildable build variants in project_dir') plus the derivation mechanism ('parsed from the assemble* tasks') and an explicit exclusion ('Test-only APK tasks (androidTest/unitTest) are excluded'). It also distinguishes itself from siblings list_gradle_tasks and list_gradle_projects by naming the latter and scoping itself to variants rather than raw tasks.

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?

Explains the exact condition that selects this tool (multi-flavor project needing task= disambiguation for gradle_build/build_and_run) and the key when-not: the root project usually has no variants, so pass task="<module>:tasks" from list_gradle_projects. That is explicit routing to alternatives with a concrete failing-case warning.

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