MCPcopy Create free account
hub / github.com/crewAIInc/crewAI / create

Method create

lib/cli/src/crewai_cli/tools/main.py:67–102  ·  view source on GitHub ↗
(self, handle: str)

Source from the content-addressed store, hash-verified

65 PlusAPIMixin.__init__(self, telemetry=self._telemetry)
66
67 def create(self, handle: str) -> None:
68 self._ensure_not_in_project()
69
70 folder_name = handle.replace(" ", "_").replace("-", "_").lower()
71 class_name = handle.replace("_", " ").replace("-", " ").title().replace(" ", "")
72
73 project_root = Path(folder_name)
74 if project_root.exists():
75 click.secho(f"Folder {folder_name} already exists.", fg="red")
76 raise SystemExit
77 os.makedirs(project_root)
78
79 click.secho(f"Creating custom tool {folder_name}...", fg="green", bold=True)
80
81 template_dir = Path(__file__).parent.parent / "templates" / "tool"
82 tree_copy(template_dir, project_root)
83 tree_find_and_replace(project_root, "{{folder_name}}", folder_name)
84 tree_find_and_replace(project_root, "{{class_name}}", class_name)
85 tree_find_and_replace(
86 project_root, "{{crewai_tools_dependency}}", get_crewai_tools_dependency()
87 )
88
89 agents_md_src = Path(__file__).parent.parent / "templates" / "AGENTS.md"
90 if agents_md_src.exists():
91 shutil.copy2(agents_md_src, project_root / "AGENTS.md")
92
93 old_directory = os.getcwd()
94 os.chdir(project_root)
95 try:
96 self.login()
97 subprocess.run(["git", "init"], check=True) # noqa: S607
98 console.print(
99 f"[green]Created custom tool [bold]{folder_name}[/bold]. Run [bold]cd {project_root}[/bold] to start working.[/green]"
100 )
101 finally:
102 os.chdir(old_directory)
103
104 def publish(self, is_public: bool, force: bool = False) -> None:
105 if not git.Repository().is_synced() and not force:

Callers 11

tool_createFunction · 0.95
test_create_successFunction · 0.45
translate_release_notesFunction · 0.45
_generate_release_notesFunction · 0.45
_generate_docFunction · 0.45
_update_docFunction · 0.45
_translate_docFunction · 0.45

Calls 8

loginMethod · 0.95
tree_copyFunction · 0.90
tree_find_and_replaceFunction · 0.90
titleMethod · 0.80
runMethod · 0.45
printMethod · 0.45