search_design_tokens
Search KRDS design tokens including colors, spacing, and typography to find specific values for Korean government digital services.
Instructions
KRDS 디자인 토큰을 검색합니다 (색상, 간격, 타이포그래피 등).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| type | No | 토큰 타입 (예: color, spacing, typography) | |
| query | No | 검색할 키워드 (예: primary, blue, font) |
Implementation Reference
- src/tools/token-provider.ts:7-13 (handler)Core handler function implementing the search_design_tokens tool logic. It delegates to KRDSLoader.searchTokens with optional type and query filters.
export async function searchDesignTokens( loader: KRDSLoader, type?: string, query?: string ): Promise<TokenSearchResult[]> { return await loader.searchTokens(type, query); } - src/index.ts:151-167 (registration)Tool registration in getTools() method, defining name 'search_design_tokens', description, and input schema.
{ name: 'search_design_tokens', description: 'KRDS 디자인 토큰을 검색합니다 (색상, 간격, 타이포그래피 등).', inputSchema: { type: 'object', properties: { type: { type: 'string', description: '토큰 타입 (예: color, spacing, typography)', }, query: { type: 'string', description: '검색할 키워드 (예: primary, blue, font)', }, }, }, }, - src/index.ts:286-311 (handler)MCP protocol handler that executes the tool, calls the core searchDesignTokens function, handles empty results, formats output as formatted text response.
private async handleSearchTokens(args: any) { const results = await searchDesignTokens(this.loader, args?.type, args?.query); if (results.length === 0) { return { content: [{ type: 'text', text: '검색 결과가 없습니다.', }], }; } const text = `찾은 디자인 토큰 (${results.length}개):\n\n` + results.slice(0, 50).map(token => `🎨 ${token.name}\n` + ` 값: ${token.value}\n` + ` 타입: ${token.type}\n` + ` CSS: var(${token.cssVariable})\n` + ` SCSS: ${token.scssVariable}` ).join('\n\n') + (results.length > 50 ? `\n\n... 그 외 ${results.length - 50}개` : ''); return { content: [{ type: 'text', text }], }; } - src/types/krds.ts:24-30 (schema)TypeScript interface defining the structure of TokenSearchResult, used as output type for the search_design_tokens tool.
export interface TokenSearchResult { name: string; value: string; type: string; cssVariable?: string; scssVariable?: string; }