get_token_stats
Retrieve statistical information about design tokens from Korea's government digital design system to analyze token usage and distribution patterns.
Instructions
디자인 토큰 통계 정보를 가져옵니다.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/token-provider.ts:18-27 (handler)Core handler function that fetches all design tokens using KRDSLoader and computes statistics by counting occurrences per token type.export async function getTokenStats(loader: KRDSLoader): Promise<Record<string, number>> { const allTokens = await loader.searchTokens(); const stats: Record<string, number> = {}; allTokens.forEach(token => { stats[token.type] = (stats[token.type] || 0) + 1; }); return stats; }
- src/index.ts:327-339 (handler)MCP server-specific handler that invokes the core getTokenStats function and formats the statistics as a sorted text response for the protocol.private async handleGetTokenStats() { const stats = await getTokenStats(this.loader); const text = `디자인 토큰 통계:\n\n` + Object.entries(stats) .sort((a, b) => b[1] - a[1]) .map(([type, count]) => `• ${type}: ${count}개`) .join('\n'); return { content: [{ type: 'text', text }], }; }
- src/index.ts:176-183 (registration)Registers the 'get_token_stats' tool in the MCP server with description and empty input schema (no parameters required).{ name: 'get_token_stats', description: '디자인 토큰 통계 정보를 가져옵니다.', inputSchema: { type: 'object', properties: {}, }, },
- src/tools/token-provider.ts:18-18 (schema)TypeScript type definition for the function's input (KRDSLoader) and output (Record<string, number> for token type counts).export async function getTokenStats(loader: KRDSLoader): Promise<Record<string, number>> {
- src/index.ts:75-76 (registration)Switch case in the tool request handler that dispatches 'get_token_stats' calls to the specific handler method.case 'get_token_stats': return await this.handleGetTokenStats();