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

Method load_resources

ms_agent/skill/schema.py:545–573  ·  view source on GitHub ↗

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

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

Source from the content-addressed store, hash-verified

543 return loaded
544
545 def load_resources(self, names: List[str] = None) -> List[Dict[str, Any]]:
546 """
547 Load specific resources by name, or all if names is None.
548
549 Args:
550 names: List of resource names to load, or None for all.
551
552 Returns:
553 List of loaded resource dictionaries with content.
554 """
555 target_res = [
556 r for r in self.skill.resources
557 if r.name not in ['SKILL.md', 'LICENSE.txt']
558 ]
559 if names:
560 target_res = [r for r in target_res if r.name in names]
561
562 loaded = []
563 for res in target_res:
564 abs_path = res.path.resolve()
565 loaded.append({
566 'name': res.name,
567 'file': res.to_dict(),
568 'path': self._get_resource_path(res.path),
569 'abs_path': str(abs_path),
570 'content': self._read_file_content(abs_path),
571 })
572 self.resources.extend(loaded)
573 return loaded
574
575 def load_from_plan(self) -> None:
576 """

Callers 2

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