generate_sfc_template_client
Download and transform SFC/Vue template files to the specified workspace directory, simplifying frontend development workflows within the Swiftcode MCP Server environment.
Instructions
下载转换 sfc / vue 列表的模板文件当前目录下 / Download the transform sfc template files
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dir | Yes | workspace dir |
Implementation Reference
- src/index.ts:193-214 (handler)The handler function for the 'generate_sfc_template_client' tool. It extracts the 'dir' argument, calls createTemplate('template.js', '', dir) to generate the SFC template file in the specified directory, and returns a success message or throws an MCP error on failure.case 'generate_sfc_template_client': { const { dir } = args // 直接使用导入的模板内容,写入到目标目录 try { createTemplate('template.js', '', dir) return { content: [ { type: 'text', text: `SFC template file created successfully at ${path.join(dir, 'template.js')}`, }, ], } } catch (error) { console.error('Error while generating SFC template files:', error) throw new McpError(ErrorCode.InternalError, 'Failed to generate SFC template files', { code: ErrorCode.InternalError, message: `Failed to generate SFC template files: ${error instanceof Error ? error.message : 'Unknown error'}`, }) } }
- src/index.ts:40-49 (schema)Input schema for the 'generate_sfc_template_client' tool, defining the required 'dir' property.inputSchema: { type: 'object', properties: { dir: { type: 'string', description: 'workspace dir', }, }, required: ['dir'], },
- src/index.ts:37-50 (registration)Tool registration in the TOOLS array, including name, description, and input schema. This is returned by the listTools handler.{ name: 'generate_sfc_template_client', description: '下载转换 sfc / vue 列表的模板文件当前目录下 / Download the transform sfc template files', inputSchema: { type: 'object', properties: { dir: { type: 'string', description: 'workspace dir', }, }, required: ['dir'], }, },
- src/index.ts:84-94 (registration)Prompt registration in the PROMPTS array for 'generate_sfc_template_client'.{ name: 'generate_sfc_template_client', description: '下载 swiftcode 生成 sfc 的模板文件', arguments: [ { name: 'template', description: '', required: false, }, ], },