Skip to main content
Glama

Kotlin & Android Best Practices

kotlin_best_practices
Read-only

Obtain official Kotlin and Android code patterns with ready-to-use snippets and anti-patterns for coroutines, Compose, Room, Hilt, and more.

Instructions

Returns official Kotlin and Android code patterns with ready-to-use snippets and explicit anti-patterns. All snippets are sourced from developer.android.com and kotlinlang.org. Call this when generating coroutine code, StateFlow/LiveData usage, Compose state, Room DAOs, Hilt injection, Navigation, or WorkManager tasks. Available patterns: coroutines-viewmodel, stateflow-ui, compose-state, room-dao, hilt-injection, navigation-compose, workmanager-task, sealed-result. Pass any topic keyword or call with no topic to list all patterns.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicNoPattern name or keyword. E.g. 'coroutines', 'compose state', 'room', 'hilt'. Leave empty to list all.
Behavior4/5

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

Annotations declare readOnlyHint=true, and the description is consistent (returns patterns, no modification). The description adds value by specifying the source (developer.android.com and kotlinlang.org) and listing available patterns, enhancing transparency beyond annotations.

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 a single, well-structured paragraph with no wasted words. It front-loads the main action, then provides usage triggers, sources, and parameter guidance, making it efficient and easy to parse.

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?

Given the tool's simplicity (one optional parameter, no output schema, read-only), the description is comprehensive. It covers purpose, usage conditions, parameter semantics, and reliability sources, leaving no significant gaps for an agent.

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

Parameters5/5

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

The input schema has 100% coverage with a description for the 'topic' parameter. The tool description adds examples ('coroutines', 'compose state') and clarifies that leaving it empty lists all patterns, providing meaningful context beyond the schema.

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 returns official Kotlin and Android code patterns with snippets and anti-patterns, specifying the verb 'returns' and resource 'code patterns'. It distinguishes from sibling tools (e.g., compliance, debugging) by listing specific pattern categories and use cases.

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 states when to call the tool (e.g., when generating coroutine code, Compose state, Room DAOs) and how to use the topic parameter, including leaving it empty to list all patterns. It does not explicitly mention when not to use it or alternative tools, but the guidance is clear enough.

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