Skip to main content
Glama

requirement-structuring

Analyze natural language requests to structure UI component requirements into clear documentation for Vue development.

Instructions

analyze the user's natural language and structure the requirements into a clear and structured component requirement document. Use this tool when the user requests a new UI component—e.g., mentions /ui, or asks for a button, input, dialog, table, form, banner, card, or other Vue component

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageYesContent about user requirement in specific contextual information

Implementation Reference

  • The main handler function for the 'requirement-structuring' tool. It detects the preferred icon library from the input message, constructs a detailed prompt instructing an AI to structure the requirement into a specific JSON format (main_goal, data_structure, user_actions, icon), and returns this prompt as a text content block to be processed by the model.
        execute: async (params) => {
          // 智能识别用户描述中的图标库偏好
          const detectIconLibrary = (message: string): "@nuxt/icon" | "lucide" => {
            const lowerMessage = message.toLowerCase();
            // 优先检查明确的图标库关键词
            if (lowerMessage.includes("nuxt")) {
              return "@nuxt/icon";
            }
            // 如果没有明确指定,返回默认值
            return "lucide";
          };
    
          // 如果用户没有显式指定 icon,则从描述中智能识别
          const icon = detectIconLibrary(params.message);
    
          const prompt = `
    # Role
    You are a Vue.js Frontend Architect, an expert in shadcn-vue.
    
    # Task
    Your task is to convert a simple user requirement into a production-ready component blueprint in JSON format. Analyze the user's underlying intent and add essential features they might have overlooked, such as loading states, error handling, user interactions, edge cases, and accessibility.
    
    # Input
    The user requirement will be provided via the \`${params.message}\` variable.
    
    # Output Requirements
    1.  **Strictly** return a single, valid JSON object with absolutely no extra text, explanations, or markdown.
    2.  The JSON object **must** strictly follow this exact structure:
        \`\`\`json
        {
          "main_goal": "A one-sentence summary of the component's core purpose.",
          "data_structure": {
            "propertyName": "TypeScriptType - Brief description of its purpose."
          },
          "user_actions": {
            "actionName": "Description of the action's trigger and its effect."
          },
          "icon": "${icon}"
        }
       \`\`\`
    3.  After outputting the JSON, you **must** call the \`components-filter\` tool with the JSON string format as the input. 
      `;
    
          return {
            content: [
              {
                type: "text",
                text: prompt,
              },
            ],
          };
        },
  • Zod schema defining the input parameters for the tool: a single 'message' string containing the user's requirement description.
    parameters: z.object({
      message: z
        .string()
        .describe("Content about user requirement in specific contextual information"),
    }),
  • The registration of the 'requirement-structuring' tool on the FastMCP server instance, specifying name, description, input schema, and handler function.
      server.addTool({
        name: "requirement-structuring",
        description:
          "analyze the user's natural language and structure the requirements into a clear and structured component requirement document. Use this tool when the user requests a new UI component—e.g., mentions /ui, or asks for a button, input, dialog, table, form, banner, card, or other Vue component",
        parameters: z.object({
          message: z
            .string()
            .describe("Content about user requirement in specific contextual information"),
        }),
        execute: async (params) => {
          // 智能识别用户描述中的图标库偏好
          const detectIconLibrary = (message: string): "@nuxt/icon" | "lucide" => {
            const lowerMessage = message.toLowerCase();
            // 优先检查明确的图标库关键词
            if (lowerMessage.includes("nuxt")) {
              return "@nuxt/icon";
            }
            // 如果没有明确指定,返回默认值
            return "lucide";
          };
    
          // 如果用户没有显式指定 icon,则从描述中智能识别
          const icon = detectIconLibrary(params.message);
    
          const prompt = `
    # Role
    You are a Vue.js Frontend Architect, an expert in shadcn-vue.
    
    # Task
    Your task is to convert a simple user requirement into a production-ready component blueprint in JSON format. Analyze the user's underlying intent and add essential features they might have overlooked, such as loading states, error handling, user interactions, edge cases, and accessibility.
    
    # Input
    The user requirement will be provided via the \`${params.message}\` variable.
    
    # Output Requirements
    1.  **Strictly** return a single, valid JSON object with absolutely no extra text, explanations, or markdown.
    2.  The JSON object **must** strictly follow this exact structure:
        \`\`\`json
        {
          "main_goal": "A one-sentence summary of the component's core purpose.",
          "data_structure": {
            "propertyName": "TypeScriptType - Brief description of its purpose."
          },
          "user_actions": {
            "actionName": "Description of the action's trigger and its effect."
          },
          "icon": "${icon}"
        }
       \`\`\`
    3.  After outputting the JSON, you **must** call the \`components-filter\` tool with the JSON string format as the input. 
      `;
    
          return {
            content: [
              {
                type: "text",
                text: prompt,
              },
            ],
          };
        },
      });
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It describes the transformation behavior (natural language to structured document) but lacks details about output format, processing limitations, error handling, or performance characteristics. The description adds value by explaining the transformation but doesn't provide comprehensive behavioral context.

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

Conciseness4/5

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

The description is appropriately sized with two sentences that each serve distinct purposes: the first explains the tool's function, the second provides usage guidelines. It's front-loaded with the core purpose. Minor improvement could be made by slightly tightening the example list.

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

Completeness3/5

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

For a single-parameter tool with no annotations and no output schema, the description provides adequate purpose and usage context but lacks details about the output format, processing behavior, or limitations. Given the transformation nature of the tool and absence of output schema, more information about what the structured document looks like would be helpful.

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 the single 'message' parameter. The description adds context about what the parameter should contain ('user's natural language', 'user requirement in specific contextual information'), but doesn't provide additional syntax, format, or constraints beyond what the schema indicates.

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

Purpose5/5

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

The description clearly states the tool's purpose with specific verbs ('analyze', 'structure') and resource ('requirements into a clear and structured component requirement document'). It distinguishes from siblings by focusing on requirement analysis rather than building, checking, filtering, or documenting components.

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

Usage Guidelines5/5

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

The description explicitly states when to use this tool: 'when the user requests a new UI component' and provides concrete examples (mentions of /ui, button, input, dialog, etc.). It implicitly distinguishes from siblings by focusing on requirement structuring rather than other component-related tasks.

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/HelloGGX/shadcn-vue-mcp'

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