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

Method execute

tools/skills_tool.py:101–140  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

99 self.log = self.get_log_object()
100
101 async def execute(self, **kwargs) -> Response:
102 action = self._current_action(**kwargs)
103
104 query = str(kwargs.get("query") or self.args.get("query") or "").strip()
105 skill_name = self._normalize_skill_name(
106 str(kwargs.get("skill_name") or self.args.get("skill_name") or "")
107 )
108 file_path = str(
109 kwargs.get("file_path") or self.args.get("file_path") or ""
110 ).strip()
111
112 if "action" not in kwargs and "action" not in self.args and "method" in kwargs:
113 kwargs["action"] = action
114 if "action" not in self.args and "method" in self.args:
115 self.args["action"] = action
116
117 try:
118 if action == "list":
119 return Response(message=self._list(), break_loop=False)
120 if action == "search":
121 return Response(message=self._search(query), break_loop=False)
122 if action == "load":
123 return self._load(skill_name)
124 if action == "read_file":
125 return Response(
126 message=self._read_file(skill_name, file_path),
127 break_loop=False,
128 )
129
130 return Response(
131 message=(
132 "Error: missing/invalid 'action'. Supported actions: "
133 "list, search, load, read_file."
134 ),
135 break_loop=False,
136 )
137 except (
138 Exception
139 ) as e: # keep tool robust; return error instead of crashing loop
140 return Response(message=f"Error in skills_tool: {e}", break_loop=False)
141
142 def _list(self) -> str:
143 skills = skills_helper.list_skills(

Calls 8

_current_actionMethod · 0.95
_normalize_skill_nameMethod · 0.95
_listMethod · 0.95
_searchMethod · 0.95
_loadMethod · 0.95
_read_fileMethod · 0.95
ResponseClass · 0.90
getMethod · 0.45