MCPcopy Create free account
hub / github.com/agent0ai/agent-zero / _load

Method _load

tools/skills_tool.py:191–252  ·  view source on GitHub ↗
(self, skill_name: str)

Source from the content-addressed store, hash-verified

189 return "\n".join(lines)
190
191 def _load(self, skill_name: str) -> Response:
192 skill_name = self._normalize_skill_name(skill_name)
193
194 if not skill_name:
195 return Response(
196 message="Error: 'skill_name' is required for action=load.",
197 break_loop=False,
198 )
199
200 # Verify skill exists
201 skill = skills_helper.find_skill(
202 skill_name,
203 include_content=False,
204 agent=self.agent,
205 )
206 if not skill:
207 return Response(
208 message=(
209 f"Error: skill not found: {skill_name!r}. "
210 "Try skills_tool action=list or action=search."
211 ),
212 break_loop=False,
213 )
214
215 skill_data = skills_helper.load_skill_for_agent(
216 skill_name=skill.name,
217 agent=self.agent,
218 )
219 metadata = {
220 "name": skill.name,
221 "path": str(skill.path),
222 "source": "skills_tool:load",
223 "content_included": True,
224 }
225
226 skills_helper.add_loaded_skill_name(
227 self.agent,
228 skill.name,
229 limit=max_loaded_skills(),
230 )
231
232 if self._visible_skill_loaded(skill.name):
233 return Response(
234 message=(
235 f"Skill '{skill.name}' is already loaded in visible "
236 "chat history."
237 ),
238 break_loop=False,
239 additional={
240 "skill_instructions": {
241 **metadata,
242 "content_included": False,
243 "already_loaded": True,
244 }
245 },
246 )
247
248 return Response(

Callers 1

executeMethod · 0.95

Calls 4

_normalize_skill_nameMethod · 0.95
_visible_skill_loadedMethod · 0.95
ResponseClass · 0.90
max_loaded_skillsFunction · 0.85

Tested by

no test coverage detected