Skip to main content
Glama
hongaah

Swiftcode MCP Server

by hongaah

generate_sfc_client

Generate Vue.js single-file components from SFC templates to create list components and pages for frontend development.

Instructions

使用 sfc 模板生成 vue 列表组件 / Generate vue sfc component page.Examples: For file only returns vue sfc pages, default file name: 'template.js'

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYessfc 模板文件路径 / sfc template file path
dirYesworkspace dir

Implementation Reference

  • The handler function for the 'generate_sfc_client' tool. It destructures source and dir from arguments, determines if source is a file path, constructs paths, calls Template2ListOutput to generate SFC files in the '.lists' subdirectory, and returns a success message or throws an MCP error on failure.
    case 'generate_sfc_client': {
      const { source, dir } = args
      try {
        // 判断 source 是否是文件路径
        const isFilePath = source.startsWith('/')
        const filePath = isFilePath ? `/${source}` : source
        const dirPath = path.join(dir, '.lists')
        await Template2ListOutput({
          source: filePath,
          dir: dirPath
        })
        return {
          content: [
            {
              type: 'text',
              text: 'SFC files generated successfully.',
            },
          ],
        }
      } catch (error) {
        console.error('Error while generating SFC files:', error)
        throw new McpError(ErrorCode.InternalError, 'Failed to generate SFC files', {
          code: ErrorCode.InternalError,
          message: 'Failed to generate SFC files',
        })
      }
    }
  • src/index.ts:51-69 (registration)
    Registration of the 'generate_sfc_client' tool in the TOOLS array, including its name, description, and input schema used for listing tools.
    {
      name: 'generate_sfc_client',
      description:
        "使用 sfc 模板生成 vue 列表组件 / Generate vue sfc component page.Examples: For file only returns vue sfc pages, default file name: 'template.js'",
      inputSchema: {
        type: 'object',
        properties: {
          source: {
            type: 'string',
            description: 'sfc 模板文件路径 / sfc template file path',
          },
          dir: {
            type: 'string',
            description: 'workspace dir',
          },
        },
        required: ['source', 'dir'],
      },
    },
  • Input schema definition for the 'generate_sfc_client' tool, specifying properties for source (template file path) and dir (workspace directory).
    inputSchema: {
      type: 'object',
      properties: {
        source: {
          type: 'string',
          description: 'sfc 模板文件路径 / sfc template file path',
        },
        dir: {
          type: 'string',
          description: 'workspace dir',
        },
      },
      required: ['source', 'dir'],
    },
  • src/index.ts:96-105 (registration)
    Registration of the 'generate_sfc_client' prompt in the PROMPTS array.
      name: 'generate_sfc_client',
      description: '使用 swiftcode sfc 模板生成 vue 列表组件',
      arguments: [
        {
          name: 'sfc',
          description: '',
          required: false,
        },
      ],
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions 'For file only returns vue sfc pages' which suggests a file generation behavior, but doesn't disclose important traits like whether this overwrites existing files, what permissions are needed, error conditions, or what happens when generation fails. The description provides minimal behavioral context beyond the basic operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is relatively concise but poorly structured. It mixes languages (Chinese and English) without clear separation, and the example about 'file only returns' feels tacked on rather than integrated. While not verbose, the structure could be improved for better readability and information hierarchy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a code generation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what the generated component looks like, what template features are supported, error handling, or success criteria. The example about 'default file name: template.js' adds some context but doesn't compensate for the missing behavioral and output information needed for effective tool use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents both parameters ('source' and 'dir') with clear descriptions. The description adds no additional parameter semantics beyond what's in the schema - it doesn't explain parameter relationships, constraints, or usage patterns. The baseline of 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool '生成 vue sfc 组件页面 / Generate vue sfc component page' which indicates it creates Vue single-file components. However, it's vague about the specific resource being generated (just 'component page') and doesn't clearly distinguish from sibling tools like 'generate_sfc_template_client' which likely generates templates rather than components. The description provides basic purpose but lacks specificity about what makes this tool unique.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There's no mention of when this tool is appropriate versus 'generate_api_client' or 'generate_sfc_template_client', nor any prerequisites or context for usage. The example about file returns is operational rather than guidance about tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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