import { z } from "zod";
import { CLIExecutor } from "../lib/cli-executor.js";
const ListComponentsInputSchema = z.object({
  category: z.string().optional().describe("Filter components by category"),
  detailed: z.boolean().optional().describe("Include detailed component information")
});
class ListComponentsTool {
  cli;
  constructor() {
    this.cli = new CLIExecutor();
  }
  async execute(input) {
    try {
      const components = await this.cli.listComponents();
      let filtered = components;
      if (input.category) {
        filtered = components.filter(
          (c) => c.category?.toLowerCase() === input.category?.toLowerCase()
        );
      }
      return {
        components: filtered,
        total: filtered.length
      };
    } catch (error) {
      throw new Error(
        `Failed to list components: ${error instanceof Error ? error.message : String(error)}`
      );
    }
  }
}
export {
  ListComponentsInputSchema,
  ListComponentsTool
};
