2828
2929def tail_logs (
3030 app_identifier : str = typer .Argument (
31- help = "Server ID, URL, or app configuration ID to retrieve logs for"
31+ help = "App ID or app configuration ID to retrieve logs for"
3232 ),
3333 since : Optional [str ] = typer .Option (
3434 None ,
@@ -83,7 +83,7 @@ def tail_logs(
8383 mcp-agent cloud logger tail app_abc123 --limit 50
8484
8585 # Stream logs continuously
86- mcp-agent cloud logger tail https://app.mcpac.dev/abc123 --follow
86+ mcp-agent cloud logger tail app_abc123 --follow
8787
8888 # Show logs from the last hour with error filtering
8989 mcp-agent cloud logger tail app_abc123 --since 1h --grep "ERROR|WARN"
@@ -129,14 +129,17 @@ def tail_logs(
129129 console .print ("[red]Error: --format must be 'text', 'json', or 'yaml'[/red]" )
130130 raise typer .Exit (6 )
131131
132- app_id , config_id , server_url = parse_app_identifier (app_identifier )
132+ try :
133+ app_id , config_id = parse_app_identifier (app_identifier )
134+ except ValueError as e :
135+ console .print (f"[red]Error: { e } [/red]" )
136+ raise typer .Exit (6 )
133137
134138 try :
135139 if follow :
136140 asyncio .run (_stream_logs (
137141 app_id = app_id ,
138142 config_id = config_id ,
139- server_url = server_url ,
140143 credentials = credentials ,
141144 grep_pattern = grep ,
142145 app_identifier = app_identifier ,
@@ -146,7 +149,6 @@ def tail_logs(
146149 asyncio .run (_fetch_logs (
147150 app_id = app_id ,
148151 config_id = config_id ,
149- server_url = server_url ,
150152 credentials = credentials ,
151153 since = since ,
152154 grep_pattern = grep ,
@@ -168,7 +170,6 @@ def tail_logs(
168170async def _fetch_logs (
169171 app_id : Optional [str ],
170172 config_id : Optional [str ],
171- server_url : Optional [str ],
172173 credentials : UserCredentials ,
173174 since : Optional [str ],
174175 grep_pattern : Optional [str ],
@@ -241,17 +242,15 @@ async def _fetch_logs(
241242
242243async def _stream_logs (
243244 app_id : Optional [str ],
244- config_id : Optional [str ],
245- server_url : Optional [str ],
245+ config_id : Optional [str ],
246246 credentials : UserCredentials ,
247247 grep_pattern : Optional [str ],
248248 app_identifier : str ,
249249 format : str ,
250250) -> None :
251251 """Stream logs continuously via SSE."""
252252
253- if not server_url :
254- server_url = await resolve_server_url (app_id , config_id , credentials )
253+ server_url = await resolve_server_url (app_id , config_id , credentials )
255254
256255 parsed = urlparse (server_url )
257256 stream_url = f"{ parsed .scheme } ://{ parsed .netloc } /logs"
0 commit comments