@@ -182,6 +182,23 @@ def uninstall_dependencies(self, tool_id: str) -> dict:
182182 """
183183 url = self ._make_url (tool_id ) + "/dependencies"
184184 return self ._delete (url = url )
185+
186+ def get_tool_source (self , tool_id : str ) -> str :
187+ """
188+ Get the raw tool XML source for a given tool ID.
189+
190+ :type tool_id: str
191+ :param tool_id: id of the requested tool
192+
193+ :rtype: str
194+ :return: Tool XML source as a string
195+ """
196+ try :
197+ raw_source_url = self ._make_url (tool_id ) + "/raw_tool_source"
198+ ht_response = self ._get (url = raw_source_url , json = False )
199+ return ht_response .text
200+ except Exception as e :
201+ raise RuntimeError (f"Could not retrieve tool source for tool '{ tool_id } ': { e } " )
185202
186203 def get_tool_help_text (self , tool_id : str ) -> str :
187204 """
@@ -198,12 +215,11 @@ def get_tool_help_text(self, tool_id: str) -> str:
198215 flags = re .DOTALL | re .IGNORECASE ,
199216 )
200217 try :
201- raw_source_url = self ._make_url (tool_id ) + "/raw_tool_source"
202- ht_response = self ._get (url = raw_source_url , json = False )
203- ht = HELP_BLOCK_RE .search (ht_response .text )
218+ tool_source = self .get_tool_source (tool_id )
219+ ht = HELP_BLOCK_RE .search (tool_source )
204220 return ht .group ("body" ).strip () if ht else ""
205221 except Exception as e :
206- raise RuntimeError (f"Could not retrieve tool source for tool '{ tool_id } ': { e } " )
222+ raise RuntimeError (f"Could not retrieve tool helptext for tool '{ tool_id } ': { e } " )
207223
208224 def show_tool (self , tool_id : str , io_details : bool = False , link_details : bool = False ) -> dict [str , Any ]:
209225 """
0 commit comments