Skip to main content
Glama

ako_sync_status

Read-onlyIdempotent

Check synchronization status between Kubernetes resources and AVI Controller objects, displaying counts for in-sync, pending, and error states.

Instructions

[READ] Check sync status between K8s resources and AVI Controller objects.

Shows in-sync, pending, and error counts.

Args: context: K8s context name (optional).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • Core handler: check_sync_status() function that compares K8s Ingress count vs AVI Virtual Services count to determine sync status.
    def check_sync_status(context: str | None = None) -> None:
        """Check whether K8s Ingress objects are in sync with AVI Controller VS objects."""
        cfg = load_config()
        k8s = K8sConnectionManager(cfg)
    
        from kubernetes.client import NetworkingV1Api
    
        net_v1 = NetworkingV1Api(k8s.get_client(context))
        ingresses = net_v1.list_ingress_for_all_namespaces()
        k8s_count = len(ingresses.items)
    
        mgr = AviConnectionManager(cfg)
        session = mgr.connect()
        resp = session.get("virtualservice", params={"page_size": "1000"})
        vs_list = resp.json().get("results", [])
        avi_count = len(vs_list)
    
        console.print("\n[bold]Sync Status[/bold]")
        console.print(f"  K8s Ingress objects: {k8s_count}")
        console.print(f"  AVI Virtual Services: {avi_count}")
    
        if k8s_count == avi_count:
            console.print("  [green]Counts match (basic check OK).[/green]")
        else:
            console.print(
                f"  [yellow]Count mismatch: {k8s_count} Ingresses vs {avi_count} VS. "
                "Run 'vmware-avi ako sync diff' for details.[/yellow]"
            )
        console.print()
  • Output capture helper _capture_output used by the MCP tool to capture Rich console output as plain text.
    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()
  • MCP tool registration: ako_sync_status decorated with @mcp.tool and @vmware_tool, with read-only annotation and low risk level.
    @mcp.tool(annotations={"readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": True})
    @vmware_tool(risk_level="low")
    def ako_sync_status(context: str | None = None) -> str:
        """[READ] Check sync status between K8s resources and AVI Controller objects.
    
        Shows in-sync, pending, and error counts.
    
        Args:
            context: K8s context name (optional).
        """
        from vmware_avi.ops.ako_sync import check_sync_status
        return _capture_output(check_sync_status, context)
  • CLI command registration: ako_sync_status_cmd() that wraps check_sync_status() for the vmware-avi CLI.
    @ako_app.command("sync-status")
    def ako_sync_status_cmd() -> None:
        """Check K8s-Controller sync status."""
        from vmware_avi.ops.ako_sync import check_sync_status
    
        check_sync_status()
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnlyHint=true, destructiveHint=false, and idempotentHint=true, which the description partially repeats with '[READ]'. The description adds that it shows specific counts (in-sync, pending, error), but does not disclose other behavioral traits like response structure or what happens when sync is not configured. Since annotations already cover the core behavioral safety, a score of 3 is appropriate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is brief and well-structured: a leading label '[READ]', a single sentence explaining the tool's function, and a clear listing of the parameter with description. No unnecessary words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that an output schema exists (indicated by context signals), the description does not need to detail return values. It covers the tool's purpose, the key result (counts by status), and the sole parameter. For a simple read-only status check, this is sufficient, though it could mention potential output format or that the tool aggregates multiple resources.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema provides no description for the 'context' parameter. The tool's description adds: 'context: K8s context name (optional).' This clarifies the parameter's purpose and optionality, adding value beyond the schema's bare type definition.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool checks sync status between K8s resources and AVI Controller objects, showing counts of in-sync, pending, and error states. This verb+resource combination is specific and distinguishes it from sibling tools like ako_sync_diff (detailed diff) and ako_sync_force (initiate sync).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives. It does not mention when not to use it or provide context for choosing between similar sync tools (e.g., ako_sync_diff, ako_sync_force). The only usage hint is that context is optional.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/zw008/VMware-AVI'

If you have feedback or need assistance with the MCP directory API, please join our Discord server