Skip to content

Commit a08251f

Browse files
committed
also accecpt URLs
1 parent 2642a52 commit a08251f

File tree

1 file changed

+17
-14
lines changed
  • src/mcp_agent/cli/cloud/commands/servers/workflows

1 file changed

+17
-14
lines changed

src/mcp_agent/cli/cloud/commands/servers/workflows/main.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
@handle_server_api_errors
2222
def list_workflows_for_server(
23-
app_id_or_config_id: str = typer.Argument(..., help="App ID (app_xxx) or app config ID (apcnf_xxx) to list workflows for"),
23+
server_id_or_url: str = typer.Argument(..., help="Server ID, app config ID, or server URL to list workflows for"),
2424
limit: Optional[int] = typer.Option(None, "--limit", help="Maximum number of results to return"),
2525
status: Optional[str] = typer.Option(None, "--status", help="Filter by status: running|failed|timed_out|canceled|terminated|completed|continued"),
2626
format: Optional[str] = typer.Option("text", "--format", help="Output format (text|json|yaml)"),
@@ -31,18 +31,24 @@ def list_workflows_for_server(
3131
3232
mcp-agent cloud servers workflows app_abc123
3333
34-
mcp-agent cloud servers workflows apcnf_xyz789 --status running
34+
mcp-agent cloud servers workflows https://server.example.com --status running
3535
36-
mcp-agent cloud servers workflows app_abc123 --limit 10 --format json
36+
mcp-agent cloud servers workflows apcnf_xyz789 --limit 10 --format json
3737
"""
3838
validate_output_format(format)
3939
client = setup_authenticated_client()
4040

41-
server = None
42-
try:
43-
server = resolve_server(client, app_id_or_config_id)
44-
except Exception:
45-
pass
41+
if server_id_or_url.startswith(('http://', 'https://')):
42+
resolved_server = resolve_server(client, server_id_or_url)
43+
44+
if hasattr(resolved_server, 'appId'):
45+
app_id_or_config_id = resolved_server.appId
46+
elif hasattr(resolved_server, 'appConfigurationId'):
47+
app_id_or_config_id = resolved_server.appConfigurationId
48+
else:
49+
raise ValueError(f"Could not extract app ID or config ID from server: {server_id_or_url}")
50+
else:
51+
app_id_or_config_id = server_id_or_url
4652

4753
max_results = limit or 100
4854

@@ -82,15 +88,12 @@ async def list_workflows_async():
8288
elif format == "yaml":
8389
_print_workflows_yaml(workflows)
8490
else:
85-
_print_workflows_text(workflows, server, status, app_id_or_config_id)
91+
_print_workflows_text(workflows, status, server_id_or_url)
8692

8793

88-
def _print_workflows_text(workflows, server, status_filter, app_id_or_config_id):
94+
def _print_workflows_text(workflows, status_filter, server_id_or_url):
8995
"""Print workflows in text format."""
90-
if server and hasattr(server, 'name') and server.name:
91-
server_name = server.name
92-
else:
93-
server_name = app_id_or_config_id
96+
server_name = server_id_or_url
9497

9598
console.print(f"\n[bold blue]📊 Workflows for Server: {server_name}[/bold blue]")
9699

0 commit comments

Comments
 (0)