Skip to main content
Glama
hongaah

Swiftcode MCP Server

by hongaah

generate_sfc_template_client

Download Vue.js SFC template files for transforming lists in your current directory to streamline frontend component development.

Instructions

下载转换 sfc / vue 列表的模板文件当前目录下 / Download the transform sfc template files

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dirYesworkspace dir

Implementation Reference

  • Handler implementation for the 'generate_sfc_template_client' tool. Extracts 'dir' from arguments, calls createTemplate('template.js', '', dir) to generate the SFC template file in the workspace 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:37-50 (registration)
    Tool registration in the TOOLS array, defining the name, description, and input schema (requiring 'dir' parameter). This is used by the MCP server for listing tools.
    {
      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'],
      },
    },
  • Input schema definition for the 'generate_sfc_template_client' tool, specifying an object with a required 'dir' string property.
    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', which may be used alongside the tool.
    {
      name: 'generate_sfc_template_client',
      description: '下载 swiftcode 生成 sfc 的模板文件',
      arguments: [
        {
          name: 'template',
          description: '',
          required: false,
        },
      ],
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hongaah/swiftcode-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server