get-design-tokens
Access and filter design tokens from Visa's Design System by category (color, typography, spacing, elevation, motion) or deprecated status for consistent UI implementation.
Instructions
Get design tokens with optional category filtering
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| category | No | Filter tokens by category (color, typography, spacing, elevation, motion) | |
| deprecated | No | Filter by deprecated status (true for deprecated, false for active) |
Implementation Reference
- src/mcp-server.ts:348-363 (handler)MCP handler function that executes the get-design-tokens tool: calls DesignTokenService.getTokens with args and returns formatted JSON response with token list, count, and category.private async handleGetDesignTokens(args: Record<string, any>): Promise<CallToolResult> { const tokens = await this.designTokenService.getTokens(args); return { content: [ { type: 'text', text: JSON.stringify({ tokens, count: tokens.length, category: args.category || 'all' }, null, 2) } ] }; }
- src/mcp-server.ts:118-131 (schema)Input schema definition for the get-design-tokens tool, defining optional category filter (enum) and deprecated boolean filter.inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'Filter tokens by category (color, typography, spacing, elevation, motion)', enum: ['color', 'typography', 'spacing', 'elevation', 'motion'] }, deprecated: { type: 'boolean', description: 'Filter by deprecated status (true for deprecated, false for active)' } } }
- src/mcp-server.ts:115-132 (registration)Tool registration in getToolDefinitions(): defines name, description, and inputSchema for get-design-tokens.{ name: 'get-design-tokens', description: 'Get design tokens with optional category filtering', inputSchema: { type: 'object', properties: { category: { type: 'string', description: 'Filter tokens by category (color, typography, spacing, elevation, motion)', enum: ['color', 'typography', 'spacing', 'elevation', 'motion'] }, deprecated: { type: 'boolean', description: 'Filter by deprecated status (true for deprecated, false for active)' } } } },
- src/mcp-server.ts:290-291 (handler)Switch case in handleToolCall that routes get-design-tokens calls to the handler function.case 'get-design-tokens': return await this.handleGetDesignTokens(args);
- Core helper method in DesignTokenService that fetches design tokens from cache and applies optional filters (category, deprecated).async getTokens(options?: DesignTokenSearchOptions): Promise<DesignToken[]> { const cachedData = this.dataManager.getCachedData(); if (!cachedData) { throw this.createError('NO_DATA', 'No design token data available', [ 'Ensure data files are loaded', 'Check data directory configuration' ]); } let tokens = cachedData.designTokens; // Apply filters if provided if (options) { tokens = this.filterTokens(tokens, options); } return tokens; }