1414
1515# ── Helper ─────────────────────────────────────────────────────────
1616
17+
1718def run (cmd : str ) -> str :
1819 """Run a shell command and return its output."""
1920 try :
@@ -23,7 +24,11 @@ def run(cmd: str) -> str:
2324 output = result .stdout .strip ()
2425 if result .returncode != 0 :
2526 error = result .stderr .strip ()
26- return f"Error: { error } " if error else f"Command failed with code { result .returncode } "
27+ return (
28+ f"Error: { error } "
29+ if error
30+ else f"Command failed with code { result .returncode } "
31+ )
2732 return output if output else "Done."
2833 except subprocess .TimeoutExpired :
2934 return "Error: Command timed out after 30 seconds."
@@ -33,6 +38,7 @@ def run(cmd: str) -> str:
3338
3439# ── Docker Container Tools ─────────────────────────────────────────
3540
41+
3642@mcp .tool ()
3743def docker_list_containers (all : bool = False ) -> str :
3844 """List Docker containers. Set all=True to include stopped containers."""
@@ -175,10 +181,13 @@ def docker_stats(containers: Optional[list[str]] = None) -> str:
175181
176182# ── Docker Image Tools ─────────────────────────────────────────────
177183
184+
178185@mcp .tool ()
179186def docker_images () -> str :
180187 """List all Docker images."""
181- return run ("docker images --format 'table {{.Repository}}\\ t{{.Tag}}\\ t{{.ID}}\\ t{{.Size}}'" )
188+ return run (
189+ "docker images --format 'table {{.Repository}}\\ t{{.Tag}}\\ t{{.ID}}\\ t{{.Size}}'"
190+ )
182191
183192
184193@mcp .tool ()
@@ -208,6 +217,7 @@ def docker_rmi(images: list[str], force: bool = False) -> str:
208217
209218# ── Docker Compose Tools ───────────────────────────────────────────
210219
220+
211221@mcp .tool ()
212222def docker_compose_up (
213223 project_dir : str , detach : bool = True , services : Optional [list [str ]] = None
@@ -253,6 +263,7 @@ def docker_compose_ps(project_dir: str) -> str:
253263
254264# ── Docker System Tools ────────────────────────────────────────────
255265
266+
256267@mcp .tool ()
257268def docker_system_prune (all : bool = False , volumes : bool = False ) -> str :
258269 """Remove unused Docker data (containers, images, networks, build cache).
@@ -277,6 +288,7 @@ def docker_system_df() -> str:
277288
278289# ── Docker Network Tools ───────────────────────────────────────────
279290
291+
280292@mcp .tool ()
281293def docker_network_ls () -> str :
282294 """List Docker networks."""
@@ -300,6 +312,7 @@ def docker_network_create(name: str, driver: Optional[str] = None) -> str:
300312
301313# ── Docker Volume Tools ────────────────────────────────────────────
302314
315+
303316@mcp .tool ()
304317def docker_volume_ls () -> str :
305318 """List Docker volumes."""
@@ -318,6 +331,7 @@ def docker_volume_create(name: str) -> str:
318331
319332# ── OrbStack VM Tools ─────────────────────────────────────────────
320333
334+
321335@mcp .tool ()
322336def orb_list () -> str :
323337 """List OrbStack Linux machines (VMs)."""
@@ -395,6 +409,7 @@ def orb_info() -> str:
395409
396410# ── Kubernetes Tools ───────────────────────────────────────────────
397411
412+
398413@mcp .tool ()
399414def kubectl_get (
400415 resource : str ,
@@ -417,9 +432,7 @@ def kubectl_get(
417432
418433
419434@mcp .tool ()
420- def kubectl_describe (
421- resource : str , name : str , namespace : Optional [str ] = None
422- ) -> str :
435+ def kubectl_describe (resource : str , name : str , namespace : Optional [str ] = None ) -> str :
423436 """Describe a Kubernetes resource in detail.
424437
425438 Args:
0 commit comments