( name: string | undefined, executeInventory: string, catalog: readonly Skill[], )
| 785 | // sees the artifact skills, so the index cannot advertise a how-to for tools it |
| 786 | // does not have, and fetching one by name misses like any unknown skill. |
| 787 | const skillsResult = ( |
| 788 | name: string | undefined, |
| 789 | executeInventory: string, |
| 790 | catalog: readonly Skill[], |
| 791 | ): McpToolResult => { |
| 792 | const trimmed = name?.trim(); |
| 793 | if (!trimmed) { |
| 794 | return { content: [{ type: "text", text: renderSkillsIndex(catalog) }] }; |
| 795 | } |
| 796 | const skill = findSkill(trimmed, catalog); |
| 797 | if (!skill) { |
| 798 | return { |
| 799 | content: [ |
| 800 | { type: "text", text: `No skill named "${trimmed}".\n\n${renderSkillsIndex(catalog)}` }, |
| 801 | ], |
| 802 | isError: true, |
| 803 | }; |
| 804 | } |
| 805 | const text = |
| 806 | skill.name === EXECUTE_SKILL.name && executeInventory.length > 0 |
| 807 | ? `${skill.body}\n\n${executeInventory}` |
| 808 | : skill.body; |
| 809 | return { content: [{ type: "text", text }] }; |
| 810 | }; |
| 811 | |
| 812 | /** Pull the live integration inventory block out of the built execute |
| 813 | * description (it runs from its header to the end), so the `skills` tool can |
no test coverage detected