Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ services:
image: torero-local
container_name: torero
ports:
- "22:22"
- "2222:22"
- "8001:8001"
- "8080:8080"
volumes:
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:
image: ghcr.io/torerodev/torero-container:latest
container_name: torero
ports:
- "22:22"
- "2222:22"
- "8001:8001"
- "8080:8080"
volumes:
Expand Down
49 changes: 39 additions & 10 deletions opt/torero-mcp/torero_mcp/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,15 @@ async def get_services(self) -> List[Dict[str, Any]]:
raw_output = await self.execute_command(["get", "services", "--raw"])

# handle different response formats
if isinstance(raw_output, dict) and "items" in raw_output:
return raw_output["items"]
if isinstance(raw_output, dict):
if "items" in raw_output:
return raw_output["items"]
elif "services" in raw_output:
return raw_output["services"]
else:

# if dict has no known key, raise error
raise ToreroExecutorError(f"unexpected json structure: dict with keys {list(raw_output.keys())}")
elif isinstance(raw_output, list):
return raw_output
else:
Expand Down Expand Up @@ -186,10 +193,15 @@ async def get_decorators(self) -> List[Dict[str, Any]]:
"""get all decorators."""
raw_output = await self.execute_command(["get", "decorators", "--raw"])

if isinstance(raw_output, dict) and "decorators" in raw_output:
return raw_output["decorators"]
elif isinstance(raw_output, dict) and "items" in raw_output:
return raw_output["items"]
if isinstance(raw_output, dict):
if "decorators" in raw_output:
return raw_output["decorators"]
elif "items" in raw_output:
return raw_output["items"]
else:

# if dict has no known key, raise error
raise ToreroExecutorError(f"unexpected json structure: dict with keys {list(raw_output.keys())}")
elif isinstance(raw_output, list):
return raw_output
else:
Expand Down Expand Up @@ -220,8 +232,18 @@ async def get_secrets(self) -> List[Dict[str, Any]]:
"""get all secrets."""
raw_output = await self.execute_command(["get", "secrets", "--raw"])

if isinstance(raw_output, dict) and "items" in raw_output:
return raw_output["items"]
if isinstance(raw_output, dict):
if "items" in raw_output:
return raw_output["items"]
elif "secrets" in raw_output:
return raw_output["secrets"]
elif "names" in raw_output:
# Handle case where only names are returned
return raw_output["names"]
else:

# if dict has no known key, raise error
raise ToreroExecutorError(f"unexpected json structure: dict with keys {list(raw_output.keys())}")
elif isinstance(raw_output, list):
return raw_output
else:
Expand All @@ -236,8 +258,15 @@ async def get_registries(self) -> List[Dict[str, Any]]:
"""get all registries."""
raw_output = await self.execute_command(["get", "registries", "--raw"])

if isinstance(raw_output, dict) and "items" in raw_output:
return raw_output["items"]
if isinstance(raw_output, dict):
if "items" in raw_output:
return raw_output["items"]
elif "registries" in raw_output:
return raw_output["registries"]
else:

# if dict has no known key, raise error
raise ToreroExecutorError(f"unexpected json structure: dict with keys {list(raw_output.keys())}")
elif isinstance(raw_output, list):
return raw_output
else:
Expand Down