MCPcopy
hub / github.com/Zipstack/unstract / validate_plugin_structure

Function validate_plugin_structure

workers/plugin_registry.py:200–226  ·  view source on GitHub ↗

Validate plugin structure (backward compatibility).

(plugin_name: str)

Source from the content-addressed store, hash-verified

198
199# Backward compatibility - expose the old plugin system functions
200def validate_plugin_structure(plugin_name: str) -> dict[str, bool]:
201 """Validate plugin structure (backward compatibility)."""
202 config = get_plugin_config(plugin_name)
203 plugin_path = config.get("plugin_path", "")
204
205 if not plugin_path:
206 return {"exists": False}
207
208 # Convert module path to file path for validation
209 try:
210 module_parts = plugin_path.split(".")
211 if len(module_parts) >= 3 and module_parts[0] == "workers":
212 # e.g. workers.plugins.manual_review -> workers/plugins/manual_review
213 plugin_dir = Path(__file__).parent / "/".join(module_parts[1:])
214
215 return {
216 "exists": plugin_dir.exists(),
217 "has_init": (plugin_dir / "__init__.py").exists(),
218 "has_client": (plugin_dir / "client.py").exists(),
219 "has_tasks": (plugin_dir / "tasks.py").exists(),
220 "has_dto": (plugin_dir / "dto.py").exists(),
221 "has_readme": (plugin_dir / "README.md").exists(),
222 }
223 except Exception:
224 pass
225
226 return {"exists": False}
227
228
229__all__ = [

Calls 3

get_plugin_configFunction · 0.85
getMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected