Skip to main content
Glama

Kotlin & Android Best Practices

kotlin_best_practices
Read-onlyIdempotent

Retrieve official Kotlin/Android code patterns and anti-patterns by topic to reduce hallucinations from stale training data. Leave topic empty to list all.

Instructions

Official Kotlin/Android code patterns with anti-patterns: coroutines-viewmodel, stateflow-ui, compose-state, room-dao, hilt-injection, navigation-compose, workmanager-task, sealed-result. Empty topic lists all.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
topicNoPattern name or keyword. E.g. 'coroutines', 'compose state', 'room', 'hilt'. Leave empty to list all.
refreshNoResend content already sent in this session

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv2.1.0
    • addedInput schema / properties / refresh
      Added value: +{
      +  "description": "Resend content already sent in this session",
      +  "type": "boolean"
      +}
  2. First observedv1.7.1

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint, idempotentHint, openWorldHint and destructiveHint=false, so the safety profile is covered. The description adds genuine value by naming the full topic catalog and the empty-topic listing behavior, which is behavioral context the annotations cannot convey. It stops short of describing return format or content freshness, which the 'refresh' flag hints at but never explains.

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?

A single front-loaded sentence with the core capability first, followed by the topic inventory and the empty-topic rule. It is dense but every clause carries information; the only minor cost is that the topic list reads like a schema dump.

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 read-only, zero-required-parameter lookup tool with 100% schema coverage and annotations already covering safety, the description supplies enough to invoke it correctly. The remaining gap – what the returned content looks like and how the refresh flag behaves – is modest, and there is no output schema to carry that burden.

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 description coverage is 100%: the 'topic' param already documents examples and the empty-to-list-all behavior, and 'refresh' documents re-sending session content. The description's topic list loosely mirrors the schema examples without adding syntax or matching rules (e.g., whether 'compose state' matches 'compose-state'), so baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific resource (official Kotlin/Android code patterns with anti-patterns) and enumerates the retrievable topics, so an agent knows exactly what content this tool serves. It does not, however, explicitly differentiate itself from close siblings like architecture_reference or android_official_search, leaving overlap to inference.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives one concrete usage rule ('Empty topic lists all'), which tells the agent how to use the topic parameter in list vs lookup mode. But there is no guidance on when to choose this over android_official_search, architecture_reference, or the various per-topic guide tools, so the routing decision is left implied.

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