ako_config_diff
Display pending Helm value changes not yet applied. Review differences before upgrading configuration.
Instructions
[READ] Show pending Helm value changes that haven't been applied yet.
Use before ako_config_upgrade to review what will change.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- vmware_avi/ops/ako_config.py:28-48 (handler)Core handler: runs `helm diff upgrade ako avi/ako -n avi-system` to show pending Helm changes. Returns output via rich console which is captured by the MCP server.
def diff_ako_config(namespace: str = "avi-system") -> None: """Show pending Helm changes via helm diff.""" result = subprocess.run( ["helm", "diff", "upgrade", "ako", "avi/ako", "-n", namespace], capture_output=True, text=True, timeout=120, ) if result.returncode != 0: console.print( "[yellow]helm-diff plugin may not be installed. " "Install: helm plugin install https://github.com/databus23/helm-diff[/yellow]" ) console.print(f"[red]{result.stderr.strip()}[/red]") raise SystemExit(1) if not result.stdout.strip(): console.print("[green]No pending changes.[/green]") else: console.print("\n[bold]Pending Changes[/bold]\n") console.print(result.stdout) - mcp_server/server.py:333-341 (schema)MCP tool definition: decorated with @mcp.tool and @vmware_tool, annotated as read-only, low-risk. Calls diff_ako_config() and captures output.
@mcp.tool(annotations={"readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": True}) @vmware_tool(risk_level="low") def ako_config_diff() -> str: """[READ] Show pending Helm value changes that haven't been applied yet. Use before ako_config_upgrade to review what will change. """ from vmware_avi.ops.ako_config import diff_ako_config return _capture_output(diff_ako_config) - mcp_server/server.py:333-341 (registration)Registration via @mcp.tool decorator with annotations and @vmware_tool. The function name 'ako_config_diff' becomes the tool name in MCP.
@mcp.tool(annotations={"readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": True}) @vmware_tool(risk_level="low") def ako_config_diff() -> str: """[READ] Show pending Helm value changes that haven't been applied yet. Use before ako_config_upgrade to review what will change. """ from vmware_avi.ops.ako_config import diff_ako_config return _capture_output(diff_ako_config) - mcp_server/server.py:24-48 (helper)Helper function _capture_output() that runs a function and captures its Rich console output as plain text for MCP response.
def _capture_output(func, *args, **kwargs) -> str: """Run a function and capture its Rich console output as plain text.""" import importlib # noqa: F401 — used via sys.modules lookup import sys buf = StringIO() from rich.console import Console capture_console = Console(file=buf, force_terminal=False, width=120) mod_name = func.__module__ mod = sys.modules.get(mod_name) original_console = getattr(mod, "console", None) if mod else None if mod and original_console is not None: mod.console = capture_console try: func(*args, **kwargs) except SystemExit: pass finally: if mod and original_console is not None: mod.console = original_console return buf.getvalue() - vmware_avi/cli.py:311-316 (registration)CLI command registration for 'ako config-diff' typer sub-command, also calling diff_ako_config().
@ako_app.command("config-diff") def ako_config_diff_cmd() -> None: """Show pending Helm changes (diff).""" from vmware_avi.ops.ako_config import diff_ako_config diff_ako_config()