Skip to main content

Find Tokens by Type

Find all tokens of a specific type across all your workspaces, tokensets, and modes. This tool is perfect for discovering all tokens of a particular type without needing to know workspace IDs.

Description

This helper tool searches for tokens by type across your entire Tokencraft account. It automatically discovers all workspaces and searches through all tokensets and modes to find tokens of the specified type. No workspace ID required!

Parameters

ParameterTypeRequiredDescription
typestringYesToken type to search for (color, dimension, fontSize, etc.)

Response

Returns all tokens of the specified type with:
  • token_type: The type searched for
  • results: Array of workspaces and tokensets containing matching tokens
  • total_found: Total number of matching tokens
  • usage: Instructions on how to use the returned IDs

Example Usage

# Find all dimension tokens
find_tokens_by_type(type: "dimension")

# Find all color tokens
find_tokens_by_type(type: "color")

# Find all fontSize tokens
find_tokens_by_type(type: "fontSize")

Example Response

{
  "token_type": "dimension",
  "results": [
    {
      "workspace": {
        "id": "0afa0a8a-5e59-4ef9-9619-c12ecdad3c1a",
        "name": "My Workspace"
      },
      "tokenset": {
        "id": "164809aa-cbd2-4c5f-ac1a-af6902c29f6e",
        "name": "Core"
      },
      "tokens": [
        {
          "id": "b748db41-1cb0-4e8a-b671-c9eab26bd584",
          "name": "spacing.xs",
          "type": "dimension",
          "value": "4px",
          "description": "Extra small spacing",
          "mode_id": "2edd637b-5088-4c9b-abbc-e431e5816e94",
          "alias_to": null
        },
        {
          "id": "43796993-1d65-4a89-b1a8-e210fec9c8af",
          "name": "spacing.sm",
          "type": "dimension",
          "value": "8px",
          "description": "Small spacing",
          "mode_id": "2edd637b-5088-4c9b-abbc-e431e5816e94",
          "alias_to": null
        }
      ]
    }
  ],
  "total_found": 2,
  "usage": "Use these token IDs and mode IDs in other tools"
}

Use Cases

  • Type discovery: Find all tokens of a specific type across your account
  • Type analysis: Analyze all tokens of a particular type
  • Type management: Manage all tokens of a specific type
  • Export by type: Export all tokens of a specific type
  • No workspace knowledge needed: Works without knowing workspace IDs

Supported Token Types

TypeDescriptionExample Values
colorColor values#0066CC, rgb(0, 102, 204)
dimensionSpacing, sizing16px, 2rem, 100%
fontSizeFont sizes14px, 1.2rem
fontWeightFont weights400, bold, 600
fontFamilyFont familiesInter, Arial, sans-serif
lineHeightLine heights1.5, 24px
letterSpacingLetter spacing0.1em, 1px
durationAnimation durations200ms, 0.3s
cubicBezierTiming functionsease-in-out, cubic-bezier(0.4, 0, 0.2, 1)
numberNumeric values42, 3.14
stringString values"Hello", "World"
booleanBoolean valuestrue, false
  • list_resources - Get workspace and tokenset IDs
  • search_tokens - Search tokens by name or value
  • get_tokens_by_mode - Get tokens from specific modes
  • export_tokenset - Export tokensets

Workflow Example

# 1. Find all dimension tokens
find_tokens_by_type(type: "dimension")

# 2. Use the results to update tokens
update_token(
  tokenset_id: "164809aa-cbd2-4c5f-ac1a-af6902c29f6e",
  mode_id: "2edd637b-5088-4c9b-abbc-e431e5816e94",
  token_id: "b748db41-1cb0-4e8a-b671-c9eab26bd584",
  value: "6px"
)

Best Practices

  1. Use exact type names: Use the exact token type names (case sensitive)
  2. Check all results: Review all workspaces and tokensets in results
  3. Use token IDs: Copy exact token IDs for other operations
  4. Combine with other tools: Use with search_tokens for more specific searches

Error Prevention

This tool helps prevent common errors:
  • ❌ Needing to know workspace IDs
  • ❌ Missing tokens in other workspaces
  • ❌ Using wrong token types
  • ✅ Finding all tokens of a type across your account
  • ✅ No workspace ID required

Common Use Cases

  • “Show me all dimension tokens”find_tokens_by_type(type: "dimension")
  • “Find all color tokens”find_tokens_by_type(type: "color")
  • “Get all fontSize tokens”find_tokens_by_type(type: "fontSize")
  • “List all spacing tokens”find_tokens_by_type(type: "dimension") then filter by name