Skip to main content
Glama

ako_ingress_map

Read-onlyIdempotent

Map and verify the correspondence between Kubernetes Ingress resources and AVI Virtual Services, ensuring each Ingress has a matching VS object.

Instructions

[READ] Show mapping between K8s Ingress resources and AVI Virtual Services.

Use to verify which Ingresses have corresponding VS objects.

Args: context: K8s context name (optional).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
contextNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for ako_ingress_map - calls show_ingress_map via _capture_output helper
    @mcp.tool(annotations={"readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": True})
    @vmware_tool(risk_level="low")
    def ako_ingress_map(context: str | None = None) -> str:
        """[READ] Show mapping between K8s Ingress resources and AVI Virtual Services.
    
        Use to verify which Ingresses have corresponding VS objects.
    
        Args:
            context: K8s context name (optional).
        """
        from vmware_avi.ops.ako_ingress import show_ingress_map
        return _capture_output(show_ingress_map, context)
  • Tool registered as MCP tool with FastMCP using @mcp.tool decorator; marked read-only and low risk
    @mcp.tool(annotations={"readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": True})
    @vmware_tool(risk_level="low")
    def ako_ingress_map(context: str | None = None) -> str:
        """[READ] Show mapping between K8s Ingress resources and AVI Virtual Services.
    
        Use to verify which Ingresses have corresponding VS objects.
    
        Args:
            context: K8s context name (optional).
        """
        from vmware_avi.ops.ako_ingress import show_ingress_map
        return _capture_output(show_ingress_map, context)
  • Core implementation - queries all k8s Ingresses and builds a table mapping Ingress resources to their hosts and IngressClass (proxy for VS mapping)
    def show_ingress_map(context: str | None = None) -> None:
        """Show Ingress to VS mapping across all namespaces."""
        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()
    
        table = Table(title="Ingress → VS Mapping")
        table.add_column("Namespace")
        table.add_column("Ingress")
        table.add_column("Host")
        table.add_column("IngressClass")
    
        for ing in ingresses.items:
            ns = ing.metadata.namespace
            name = ing.metadata.name
            annotations = ing.metadata.annotations or {}
            ingress_class = ing.spec.ingress_class_name or annotations.get(
                "kubernetes.io/ingress.class", ""
            )
            hosts = []
            if ing.spec.rules:
                hosts = [r.host or "*" for r in ing.spec.rules]
    
            table.add_row(ns, name, ", ".join(hosts), ingress_class or "N/A")
    
        console.print(table)
  • Helper that captures show_ingress_map's Rich console output into a string 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()
  • CLI command registration for 'ako ingress-map' (separate from MCP tool registration)
    @ako_app.command("ingress-map")
    def ako_ingress_map_cmd() -> None:
        """Show Ingress to VS mapping."""
        from vmware_avi.ops.ako_ingress import show_ingress_map
    
        show_ingress_map()
Behavior3/5

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

Annotations already provide readOnlyHint, destructiveHint, and idempotentHint. The description adds that it 'shows mapping' and is for verification, but does not elaborate on behavior beyond that. It does not contradict annotations, and the safety profile is clear. Minor improvement could be mentioning if it triggers network calls.

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?

Very concise: a one-line summary prefixed with [READ], a one-sentence usage, and an Args section. Every sentence adds value with no redundancy.

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?

For a simple tool with one optional parameter and an output schema, the description covers purpose and usage adequately. It could mention what the output looks like (mapping pairs), but since output schema exists, it's not necessary. Slightly more detail about edge cases would move it to 5.

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 has 0% coverage for description. The description explains 'Args: context: K8s context name (optional).' This adds meaningful semantics beyond the schema's 'Context' title, clarifying that it is a K8s context and optional.

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 shows mapping between K8s Ingress and AVI Virtual Services, and its purpose is to verify which Ingresses have corresponding VS objects. It distinguishes from sibling tools like ako_ingress_check or ako_ingress_diagnose.

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

Usage Guidelines4/5

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

The description explicitly states when to use the tool: 'Use to verify which Ingresses have corresponding VS objects.' It does not explicitly mention alternatives, but the context of sibling tools provides differentiation. This is clear enough for an agent.

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