| 32 | names: z.array(z.string()).describe("Array of skill names to load"), |
| 33 | }), |
| 34 | async execute(params) { |
| 35 | const loaded: Skill.Info[] = [] |
| 36 | const notFound: string[] = [] |
| 37 | |
| 38 | for (const name of params.names) { |
| 39 | const skill = await SkillRegistry.get(name) |
| 40 | if (skill) { |
| 41 | loaded.push(skill) |
| 42 | } else { |
| 43 | notFound.push(name) |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | if (loaded.length === 0 && notFound.length > 0) { |
| 48 | throw new Error(`Skills not found: ${notFound.join(", ")}. Use skill_find to discover available skills.`) |
| 49 | } |
| 50 | |
| 51 | const output = loaded.map(formatSkill).join("\n\n") |
| 52 | const summary = notFound.length > 0 ? `\n\nNote: Skills not found: ${notFound.join(", ")}` : "" |
| 53 | |
| 54 | return { |
| 55 | title: `Loaded ${loaded.length} skill${loaded.length === 1 ? "" : "s"}`, |
| 56 | output: output + summary, |
| 57 | metadata: { |
| 58 | loaded: loaded.map((s) => s.name), |
| 59 | notFound, |
| 60 | }, |
| 61 | } |
| 62 | }, |
| 63 | }) |
| 64 | |
| 65 | export const SkillFindTool = Tool.define("skill_find", { |