Skip to main content
Glama
This server has been deprecated

Rebranded to ComposeLint AI. Repository has been moved to TechsOneAi/ComposeLintAI.

add_token

Destructive

Converts a hardcoded Compose value into a design token by adding a token definition and replacing only the specified line.

Instructions

Convert a hardcoded value to a design token.

This tool:
1. Adds a new token definition to AppDimens.kt or AppColors.kt
2. Replaces ONLY the specified line with the new token
3. Does NOT touch any other line in the project

Use list_tokens() first to find hardcoded values that
could become tokens.

Args:
    file: File name (e.g., "DashboardPage.kt")
    line: Line number (1-indexed)
    value: Expected value (e.g., "16.dp" or "0xFF7C3AED")
    token_name: New token name (e.g., "padding_md")
    token_type: "dimension" or "color"
    preferred_token_file: Optional target token file (e.g. "Tokens.kt")
    force_create: ⚠️ force_create bypasses duplicate detection. Use ONLY for testing.

Returns:
    JSON with success status and details.

Input Schema

NameRequiredDescriptionDefault
fileYes
lineYes
valueYes
token_nameYes
token_typeYes
force_createNo
preferred_token_fileNo

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added
  2. Removed
  3. First observedv0.1.0

TDQS

A4.8/5.0
Behavior5/5

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

Beyond the annotations, the description discloses the exact mutation scope: it adds a token definition and replaces only the specified line without touching other lines. It also explains that force_create bypasses duplicate detection, which is important behavioral context for a destructive, non-idempotent operation.

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 front-loaded with the core action, then uses a short numbered list to explain effects and a compact Args section for parameters. Every sentence provides useful information for correctly invoking a destructive mutation tool.

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?

For a seven-parameter destructive tool with no schema descriptions, the definition covers purpose, scope, prerequisite usage, parameter meaning, and the risky force_create behavior. An output schema exists, so the brief return-value sentence is sufficient.

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?

Schema description coverage is 0%, so the description carries the full burden and does so well. It documents every parameter, gives examples for file, value, token_name, and preferred_token_file, specifies that line is 1-indexed, and states the valid token_type values.

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 states a specific verb and resource: convert a hardcoded value into a design token. It also explains the two concrete effects, adding a token definition and replacing exactly the specified line, which clearly distinguishes it from broader mutation tools like replace_pattern or set_token.

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?

It gives a clear prerequisite by telling the agent to use list_tokens() first to find hardcoded values. It also warns that force_create should be used only for testing. It stops short of explicitly naming when to use this instead of set_token or replace_pattern, so it is strong but not fully alternative-aware.

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