Tool to get detailed information about a specific skill
| 11 | |
| 12 | |
| 13 | class GetSkillTool(Tool): |
| 14 | """Tool to get detailed information about a specific skill""" |
| 15 | |
| 16 | def __init__(self, skill_loader: SkillLoader): |
| 17 | self.skill_loader = skill_loader |
| 18 | |
| 19 | @property |
| 20 | def name(self) -> str: |
| 21 | return "get_skill" |
| 22 | |
| 23 | @property |
| 24 | def description(self) -> str: |
| 25 | return "Get complete content and guidance for a specified skill, used for executing specific types of tasks" |
| 26 | |
| 27 | @property |
| 28 | def parameters(self) -> Dict[str, Any]: |
| 29 | return { |
| 30 | "type": "object", |
| 31 | "properties": { |
| 32 | "skill_name": { |
| 33 | "type": "string", |
| 34 | "description": "Name of the skill to retrieve (use list_skills to view available skills)", |
| 35 | } |
| 36 | }, |
| 37 | "required": ["skill_name"], |
| 38 | } |
| 39 | |
| 40 | async def execute(self, skill_name: str) -> ToolResult: |
| 41 | """Get detailed information about specified skill""" |
| 42 | skill = self.skill_loader.get_skill(skill_name) |
| 43 | |
| 44 | if not skill: |
| 45 | available = ", ".join(self.skill_loader.list_skills()) |
| 46 | return ToolResult( |
| 47 | success=False, |
| 48 | content="", |
| 49 | error=f"Skill '{skill_name}' does not exist. Available skills: {available}", |
| 50 | ) |
| 51 | |
| 52 | # Return complete skill content |
| 53 | result = skill.to_prompt() |
| 54 | return ToolResult(success=True, content=result) |
| 55 | |
| 56 | |
| 57 | def create_skill_tools( |
no outgoing calls