feat(nimbus-mcp): implement get_tokens tool#1249
Conversation
Adds a new `get_tokens` MCP tool that provides three modes: - No params: lists all token categories with counts - category param: returns tokens in that category (large categories like color are summarised to 20 tokens by default, controllable via limit param) - value param: reverse-lookup to find which tokens resolve to a given value (e.g. "16px" → spacing.400) Includes 15 behavioural tests covering all acceptance criteria. CRAFT-2135 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
…w large category definition
| import { getFlatTokenData, reverseLookup } from "../data-loader.js"; | ||
|
|
||
| /** Threshold above which a category is considered "large". */ | ||
| const LARGE_CATEGORY_THRESHOLD = 55; |
There was a problem hiding this comment.
why 55? size has 54 tokens, while color has 1034.
54 was a weird number.
tylermorrisford
left a comment
There was a problem hiding this comment.
Tests pass, manual inspection tests pass, we'll clean up types later, I bestow my approval 🪄
Summary
get_tokensMCP tool with three modes: list categories, filter by category, and reverse-lookup by valuelimitparam controls how many are returnedCloses CRAFT-2135
Test plan
get_tokens()returns all categories with counts, sorted alphabeticallyget_tokens(category: "spacing")returns spacing tokens includingspacing.400 = 16pxget_tokens(category: "color")returns a 20-token summary with a note (total > 55)get_tokens(category: "color", limit: 5)returns exactly 5 tokensget_tokens(value: "16px")returns an array containingspacing.400get_tokens(value: "#FEFDFB")case-insensitively resolves to a color tokenget_tokens(category: "nonexistent")returnsisError: true🤖 Generated with Claude Code