MCPcopy Create free account
hub / github.com/modelscope/ms-agent / SkillFile

Class SkillFile

ms_agent/skill/schema.py:24–63  ·  view source on GitHub ↗

Represents a file within a Skill directory. Attributes: name: File name (e.g., "SKILL.md", "script.py") type: File extension/type (e.g., ".md", ".py", ".js") path: Relative path within Skill directory required: Whether this file is required

Source from the content-addressed store, hash-verified

22
23@dataclass
24class SkillFile:
25 """
26 Represents a file within a Skill directory.
27
28 Attributes:
29 name: File name (e.g., "SKILL.md", "script.py")
30 type: File extension/type (e.g., ".md", ".py", ".js")
31 path: Relative path within Skill directory
32 required: Whether this file is required
33 """
34 name: str
35 type: str
36 path: Path
37 required: bool = False
38
39 def __post_init__(self):
40 """
41 Validate file attributes after initialization.
42
43 Raises:
44 ValueError: If file attributes are invalid
45 """
46 if not self.name:
47 raise ValueError('File name cannot be empty')
48 if not self.type:
49 raise ValueError('File type cannot be empty')
50
51 def to_dict(self):
52 """
53 Convert SkillFile to dictionary representation.
54
55 Returns:
56 Dictionary containing file information
57 """
58 return {
59 'name': self.name,
60 'type': self.type,
61 'path': str(self.path),
62 'required': self.required
63 }
64
65
66@dataclass

Callers 2

create_mock_skillFunction · 0.90
parse_skill_directoryMethod · 0.85

Calls

no outgoing calls

Tested by 1

create_mock_skillFunction · 0.72