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

Method load_scripts

ms_agent/skill/schema.py:491–516  ·  view source on GitHub ↗

Load specific scripts by name, or all if names is None. Args: names: List of script names to load, or None for all. Returns: List of loaded script dictionaries with content.

(self, names: List[str] = None)

Source from the content-addressed store, hash-verified

489 return str(resolved_path)
490
491 def load_scripts(self, names: List[str] = None) -> List[Dict[str, Any]]:
492 """
493 Load specific scripts by name, or all if names is None.
494
495 Args:
496 names: List of script names to load, or None for all.
497
498 Returns:
499 List of loaded script dictionaries with content.
500 """
501 target_scripts = self.skill.scripts
502 if names:
503 target_scripts = [s for s in self.skill.scripts if s.name in names]
504
505 loaded = []
506 for script in target_scripts:
507 abs_path = script.path.resolve()
508 loaded.append({
509 'name': script.name,
510 'file': script.to_dict(),
511 'path': self._get_resource_path(script.path),
512 'abs_path': str(abs_path),
513 'content': self._read_file_content(abs_path),
514 })
515 self.scripts.extend(loaded)
516 return loaded
517
518 def load_references(self, names: List[str] = None) -> List[Dict[str, Any]]:
519 """

Callers 3

load_from_planMethod · 0.95
load_allMethod · 0.95

Calls 4

_get_resource_pathMethod · 0.95
_read_file_contentMethod · 0.95
resolveMethod · 0.80
to_dictMethod · 0.45

Tested by

no test coverage detected