List stored tokens (plural form defaults to 'list' action).
(
action: str | None = typer.Argument(
None,
help="Action: list, set, get, delete, clear, backends, set-provider, get-provider, delete-provider",
),
name: str | None = typer.Argument(
None, help="Token/provider name (for set/get/delete actions)"
),
token_type: str = typer.Option(
"bearer", "--type", "-t", help="Token type (bearer, api-key, generic)"
),
value: str | None = typer.Option(None, "--value", help="Token value"),
provider: str | None = typer.Option(
None, "--provider", "-p", help="Provider name (for API keys)"
),
namespace: str | None = typer.Option(
None, "--namespace", "-n", help="Storage namespace"
),
show_oauth: bool = typer.Option(
True, "--show-oauth/--no-oauth", help="Show OAuth tokens (list)"
),
show_bearer: bool = typer.Option(
True, "--show-bearer/--no-bearer", help="Show bearer tokens (list)"
),
show_api_keys: bool = typer.Option(
True, "--show-api-keys/--no-api-keys", help="Show API keys (list)"
),
show_providers: bool = typer.Option(
True, "--show-providers/--no-providers", help="Show provider tokens (list)"
),
is_oauth: bool = typer.Option(
False, "--is-oauth", help="Delete OAuth token (delete)"
),
force: bool = typer.Option(
False, "--force", "-f", help="Skip confirmation (clear)"
),
quiet: bool = typer.Option(False, "-q", "--quiet", help="Suppress most log output"),
verbose: bool = typer.Option(False, "--verbose", help="Enable verbose logging"),
log_level: str = typer.Option("WARNING", "--log-level", help="Set log level"),
)
| 1497 | # Tokens command - plural form defaults to list (for consistency with providers) |
| 1498 | @app.command("tokens", help="List stored tokens (defaults to list)") |
| 1499 | def tokens_command( |
| 1500 | action: str | None = typer.Argument( |
| 1501 | None, |
| 1502 | help="Action: list, set, get, delete, clear, backends, set-provider, get-provider, delete-provider", |
| 1503 | ), |
| 1504 | name: str | None = typer.Argument( |
| 1505 | None, help="Token/provider name (for set/get/delete actions)" |
| 1506 | ), |
| 1507 | token_type: str = typer.Option( |
| 1508 | "bearer", "--type", "-t", help="Token type (bearer, api-key, generic)" |
| 1509 | ), |
| 1510 | value: str | None = typer.Option(None, "--value", help="Token value"), |
| 1511 | provider: str | None = typer.Option( |
| 1512 | None, "--provider", "-p", help="Provider name (for API keys)" |
| 1513 | ), |
| 1514 | namespace: str | None = typer.Option( |
| 1515 | None, "--namespace", "-n", help="Storage namespace" |
| 1516 | ), |
| 1517 | show_oauth: bool = typer.Option( |
| 1518 | True, "--show-oauth/--no-oauth", help="Show OAuth tokens (list)" |
| 1519 | ), |
| 1520 | show_bearer: bool = typer.Option( |
| 1521 | True, "--show-bearer/--no-bearer", help="Show bearer tokens (list)" |
| 1522 | ), |
| 1523 | show_api_keys: bool = typer.Option( |
| 1524 | True, "--show-api-keys/--no-api-keys", help="Show API keys (list)" |
| 1525 | ), |
| 1526 | show_providers: bool = typer.Option( |
| 1527 | True, "--show-providers/--no-providers", help="Show provider tokens (list)" |
| 1528 | ), |
| 1529 | is_oauth: bool = typer.Option( |
| 1530 | False, "--is-oauth", help="Delete OAuth token (delete)" |
| 1531 | ), |
| 1532 | force: bool = typer.Option( |
| 1533 | False, "--force", "-f", help="Skip confirmation (clear)" |
| 1534 | ), |
| 1535 | quiet: bool = typer.Option(False, "-q", "--quiet", help="Suppress most log output"), |
| 1536 | verbose: bool = typer.Option(False, "--verbose", help="Enable verbose logging"), |
| 1537 | log_level: str = typer.Option("WARNING", "--log-level", help="Set log level"), |
| 1538 | ) -> None: |
| 1539 | """List stored tokens (plural form defaults to 'list' action).""" |
| 1540 | # Configure logging for this command |
| 1541 | _setup_command_logging(quiet, verbose, log_level, "default") |
| 1542 | |
| 1543 | # Use unified command system via CLI adapter |
| 1544 | from mcp_cli.adapters.cli import cli_execute |
| 1545 | import asyncio |
| 1546 | |
| 1547 | async def _tokens_wrapper(): |
| 1548 | # Default to 'list' if no action specified |
| 1549 | effective_action = action or "list" |
| 1550 | |
| 1551 | return await cli_execute( |
| 1552 | "token", |
| 1553 | action=effective_action, |
| 1554 | name=name |
| 1555 | if effective_action |
| 1556 | not in ["set-provider", "get-provider", "delete-provider"] |
nothing calls this directly
no test coverage detected