Skip to main content
Glama

Android Code Validator

android_code_validator
Read-only

Validates Android code (Kotlin, XML, Gradle) for deprecated APIs, Android 16 violations, and structural issues. Returns PASS/WARN/FAIL with line-level violations and fixes.

Instructions

CALL THIS AFTER GENERATING EVERY ANDROID CODE BLOCK. This is the Level 3 loop-back gate: validates AI-generated Kotlin, XML, and Gradle code against 24 Android-specific rules before the user sees it. Detects removed APIs (AsyncTask, TestCoroutineDispatcher), deprecated patterns (ContextualFlowRow, NavController in new code, SharedPreferences), Android 16 violations (orientation locks, resizeableActivity=false), and structural issues (GlobalScope.launch, runBlocking in UI). Returns: verdict (PASS/WARN/FAIL), line-level violations with replacements and doc URLs, and explicit next-step instructions. If verdict is FAIL: fix all errors and re-run before returning code to the user. Inputs: code (required), language ('kotlin'|'xml'|'gradle', auto-detected if omitted), minSdk and targetSdk for context-aware API level checks.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
codeYesThe code block to validate
languageNoFile type — auto-detected from content if omitted
minSdkNoApp minSdk for API level context (e.g. 24)
targetSdkNoApp targetSdk for API 36 compliance checks (e.g. 36)
Behavior5/5

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

The description discloses the tool's read-only nature (consistent with readOnlyHint: true), return structure (verdict, violations with replacements and doc URLs), and next-step instructions on handling FAIL verdicts. It also notes language auto-detection, exceeding annotation info.

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?

The description is front-loaded with a critical usage instruction and structured to cover purpose, return, and inputs. While slightly lengthy, each sentence contributes necessary 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?

Despite no output schema, the description fully explains return values (verdict, violations with replacements and doc URLs) and behavior (auto-detection, SDK context). It covers all necessary aspects for a complex validation tool.

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?

With 100% schema coverage, baseline is 3. The description adds value by explaining auto-detection for 'language' and 'context-aware API level checks' for SDK parameters, going beyond schema descriptions.

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 clearly states the tool validates AI-generated Android code against 24 rules, distinguishing it from sibling compliance and guide tools. It specifies the languages (Kotlin, XML, Gradle) and types of issues detected (removed APIs, deprecated patterns, Android 16 violations).

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 description explicitly instructs to call this after every generated code block, providing strong usage guidance. However, it does not mention when not to use it or offer alternatives, though the sibling list implies its specific role.

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/VIKAS9793/AndroJack-mcp'

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