get_krds_resources
Retrieve file paths and usage instructions for KRDS design system resources including CSS, SCSS, fonts, images, and JavaScript components to build compliant Korean government digital services.
Instructions
KRDS 리소스 파일 경로와 사용법을 가져옵니다.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| resourceType | Yes | 리소스 타입 (css, scss, fonts, images, js) |
Implementation Reference
- src/index.ts:375-401 (handler)Main handler function for 'get_krds_resources' tool. Validates input, fetches resource paths using KRDSLoader, formats usage information and file list into a markdown response.private async handleGetResources(args: any) { if (!args?.resourceType) { throw new Error('resourceType이 필요합니다.'); } const files = await this.loader.getResourcePaths(args.resourceType); const usageMap: Record<string, string> = { css: 'HTML에서 사용: <link rel="stylesheet" href="node_modules/krds-uiux/resources/css/krds.css">', scss: 'SCSS 파일에서 import: @import "node_modules/krds-uiux/resources/scss/krds";', fonts: '폰트는 CSS 파일에 이미 포함되어 있습니다.', images: 'HTML에서 사용: <img src="node_modules/krds-uiux/resources/img/image.png">', js: 'JavaScript에서 import: import "node_modules/krds-uiux/resources/js/krds.js";', }; const text = `# KRDS ${args.resourceType.toUpperCase()} 리소스\n\n` + `**파일 개수:** ${files.length}개\n\n` + (files.length > 0 ? `**파일 목록:**\n${files.map(f => `• ${f}`).join('\n')}\n\n` : '파일이 없습니다.\n\n') + `**사용법:**\n${usageMap[args.resourceType as keyof typeof usageMap] || '사용법 정보가 없습니다.'}`; return { content: [{ type: 'text', text }], }; }
- src/services/krds-loader.ts:160-170 (helper)Core helper method in KRDSLoader that reads the directory for the specified resource type and returns relative paths to the resource files.async getResourcePaths(resourceType: 'css' | 'scss' | 'fonts' | 'images' | 'js'): Promise<string[]> { const resourcesPath = join(this.krdsPath, 'resources'); const targetPath = join(resourcesPath, resourceType); try { const files = await readdir(targetPath); return files.map(file => join('node_modules', 'krds-uiux', 'resources', resourceType, file)); } catch { return []; } }
- src/index.ts:198-212 (registration)Tool registration in getTools() method, including name, description, and input schema definition.{ name: 'get_krds_resources', description: 'KRDS 리소스 파일 경로와 사용법을 가져옵니다.', inputSchema: { type: 'object', properties: { resourceType: { type: 'string', description: '리소스 타입 (css, scss, fonts, images, js)', enum: ['css', 'scss', 'fonts', 'images', 'js'], }, }, required: ['resourceType'], }, },
- src/index.ts:81-82 (registration)Handler dispatch registration in the switch statement within CallToolRequestSchema handler.case 'get_krds_resources': return await this.handleGetResources(args);
- src/index.ts:204-211 (schema)Input schema definition for the resourceType parameter, including type, description, and allowed enum values.resourceType: { type: 'string', description: '리소스 타입 (css, scss, fonts, images, js)', enum: ['css', 'scss', 'fonts', 'images', 'js'], }, }, required: ['resourceType'], },