update_component
Generate update commands for Starwind UI components using npm, yarn, or pnpm package managers. Specify components and options to manage updates efficiently.
Instructions
Generates update commands for Starwind UI components
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| packageManager | No | Package manager to use (npm, yarn, pnpm) | |
| component | Yes | Component name to update | |
| additionalComponents | No | Additional components to update | |
| options | No | Additional options for updating (e.g., '--all' to update all components, '--yes' to skip confirmation prompts) |
Implementation Reference
- The handler function that implements the core logic of the 'update_component' tool. It processes input arguments to generate tailored update commands for Starwind UI components using different package managers, provides examples, options, and instructions.handler: async (args: UpdateComponentArgs) => { const packageManager = args.packageManager || "npx"; const component = args.component; const additionalComponents = args.additionalComponents || []; // Combine all components const components = [component, ...additionalComponents]; // Build the update command based on the package manager let baseCommand: string; switch (packageManager) { case "npm": baseCommand = "npx starwind@latest update"; break; case "yarn": baseCommand = "yarn dlx starwind@latest update"; break; case "pnpm": baseCommand = "pnpm dlx starwind@latest update"; break; default: baseCommand = "npx starwind@latest update"; } // Common update options const commonOptions = [ "--all", // Update all components "--yes", // Skip confirmation prompts ]; // Example components const popularComponents = [ "accordion", "button", "dialog", "dropdown", "card", "alert", "select", ]; return { packageManager, baseCommand, components, example: `${baseCommand} ${components.join(" ")}`, availableOptions: commonOptions, popularComponents, recommendations: { single: `${baseCommand} ${component} --yes`, multiple: components.length > 1 ? `${baseCommand} ${components.join(" ")} --yes` : null, all: `${baseCommand} --all --yes`, }, instructions: "Run one of these commands in your project directory to update Starwind UI components. You can combine multiple components in a single command.", note: "The update command will check for and apply updates to the specified components and will overwrite existing files. Use --yes to skip confirmation prompts.", }; },
- TypeScript interface UpdateComponentArgs and JSON inputSchema defining the expected inputs for the tool, including packageManager, component (required), additionalComponents, and options.export interface UpdateComponentArgs { /** Package manager to use (npm, yarn, pnpm) */ packageManager?: "npm" | "yarn" | "pnpm"; /** Component name to update */ component: string; /** Additional components to update */ additionalComponents?: string[]; /** Additional options for updating */ options?: string[]; } /** * Update component tool definition */ export const updateComponentTool = { name: "update_component", description: "Generates update commands for Starwind UI components", 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 update", }, additionalComponents: { type: "array", description: "Additional components to update", items: { type: "string", }, }, options: { type: "array", description: "Additional options for updating (e.g., '--all' to update all components, '--yes' to skip confirmation prompts)", items: { type: "string", }, }, }, required: ["component"], },
- src/tools/index.ts:14-44 (registration)Import of updateComponentTool and its registration into the tools Map, making it available to the MCP server.import { updateComponentTool } from "./update_component_tool.js"; /** * Collection of available tools */ const tools = new Map(); // tools.set("list_tools", { // description: "Lists all available tools", // inputSchema: { // type: "object", // properties: {}, // required: [], // }, // handler: async () => { // return Array.from(tools.entries()).map(([name, tool]) => ({ // name, // description: (tool as any).description, // inputSchema: (tool as any).inputSchema, // })); // }, // }); // Register init project tool tools.set(initProjectTool.name, initProjectTool); // Register install component tool tools.set(installComponentTool.name, installComponentTool); // Register update component tool tools.set(updateComponentTool.name, updateComponentTool);
- src/config/settings.ts:37-37 (registration)'update_component' listed in the enabled tools configuration."update_component",