install_component
Generates precise commands for installing Starwind UI components using npm, yarn, or pnpm, streamlining setup for developers.
Instructions
Generates installation commands for Starwind UI components
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| additionalComponents | No | Additional components to install | |
| component | Yes | Component name to install | |
| options | No | Additional options for installation (e.g., '--all' to install all components) | |
| packageManager | No | Package manager to use (npm, yarn, pnpm) |
Implementation Reference
- The main handler function that processes the tool arguments and generates installation commands for Starwind UI components using the specified package manager.handler: async (args: InstallComponentArgs) => { const packageManager = args.packageManager || "npx"; const component = args.component; const additionalComponents = args.additionalComponents || []; // Combine all components const components = [component, ...additionalComponents]; // Build the installation command based on the package manager let baseCommand: string; switch (packageManager) { case "npm": baseCommand = "npx starwind@latest add"; break; case "yarn": baseCommand = "yarn dlx starwind@latest add"; break; case "pnpm": baseCommand = "pnpm dlx starwind@latest add"; break; default: baseCommand = "npx starwind@latest add"; } // Common component options const commonOptions = [ "--all", // Install all components ]; // Example components const popularComponents = [ "accordion", "button", "card", "breadcrumb", "dropdown", "select", "tabs", ]; // Filtered list of requested components that are included in the popular list const requestedPopularComponents = components.filter((c) => popularComponents.includes(c)); return { packageManager, baseCommand, components, // Example with requested component(s) example: `${baseCommand} ${components.join(" ")}`, availableOptions: commonOptions, popularComponents, recommendations: { single: `${baseCommand} ${component}`, multiple: components.length > 1 ? `${baseCommand} ${components.join(" ")}` : null, all: `${baseCommand} --all`, }, instructions: "Run one of these commands in your project directory to install Starwind UI components. You can combine multiple components in a single command.", note: "Make sure you have initialized Starwind UI first with the init command.", }; },
- Input schema definition for the 'install_component' tool, specifying properties, types, descriptions, and required fields.inputSchema: { type: "object", properties: { packageManager: { type: "string", description: "Package manager to use (npm, yarn, pnpm)", enum: ["npm", "yarn", "pnpm"], }, component: { type: "string", description: "Component name to install", }, additionalComponents: { type: "array", description: "Additional components to install", items: { type: "string", }, }, options: { type: "array", description: "Additional options for installation (e.g., '--all' to install all components)", items: { type: "string", }, }, }, required: ["component"], },
- TypeScript interface defining the structure of arguments expected by the handler.export interface InstallComponentArgs { /** Package manager to use (npm, yarn, pnpm) */ packageManager?: "npm" | "yarn" | "pnpm"; /** Component name to install */ component: string; /** Additional components to install */ additionalComponents?: string[]; /** Additional options for installation */ options?: string[]; }
- src/tools/index.ts:40-41 (registration)Registers the installComponentTool in the tools Map used by the MCP server for tool handling.// Register install component tool tools.set(installComponentTool.name, installComponentTool);