add_token
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
| Name | Required | Description | Default |
|---|---|---|---|
| file | Yes | ||
| line | Yes | ||
| value | Yes | ||
| token_name | Yes | ||
| token_type | Yes | ||
| force_create | No | ||
| preferred_token_file | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |