Skip to main content
Glama

List Ambari Metric Apps

list_ambari_metric_apps

Retrieve discovered AMS application IDs from Apache Ambari, optionally including metric counts for monitoring Hadoop cluster performance.

Instructions

Return discovered AMS appIds, optionally with metric counts.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
refreshNo
include_countsNo
limitNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • This is the core handler function that implements listing available Ambari Metrics System (AMS) application IDs (apps). It fetches the dynamic metric catalog from AMS metadata and returns the sorted list of available appIds, which directly corresponds to the 'list_ambari_metric_apps' tool functionality.
    async def get_available_app_ids(use_cache: bool = True) -> List[str]:
        catalog, _ = await ensure_metric_catalog(use_cache=use_cache)
        return sorted(catalog.keys())
  • Supporting function that builds and caches the metric catalog (appId -> list of metrics) from Ambari Metrics metadata API, including fallback probing of curated apps and synonym resolution. Called by the handler.
    async def ensure_metric_catalog(use_cache: bool = True) -> Tuple[Dict[str, List[str]], Dict[str, str]]:
        """Return (catalog, lookup) built from AMS metadata, refreshing when cache expires."""
        global _DYNAMIC_CATALOG_CACHE
    
        now = time.monotonic()
        cached_catalog = _DYNAMIC_CATALOG_CACHE.get("catalog") or {}
        cached_lookup = _DYNAMIC_CATALOG_CACHE.get("lookup") or {}
        cached_timestamp = float(_DYNAMIC_CATALOG_CACHE.get("timestamp", 0.0))
    
        if use_cache and cached_catalog and now - cached_timestamp < AMBARI_METRICS_METADATA_TTL:
            return cached_catalog, cached_lookup
    
        entries = await get_metrics_metadata(None, use_cache=use_cache)
    
        # Fallback: probe common apps individually if the bulk metadata query returns nothing.
        if not entries:
            aggregated: List[Dict[str, Any]] = []
            for fallback_app in CURATED_METRIC_APP_IDS:
                if _is_excluded_app(fallback_app):
                    continue
                fallback_entries = await get_metrics_metadata(fallback_app, use_cache=use_cache)
                if fallback_entries:
                    aggregated.extend(fallback_entries)
            entries = aggregated
    
        metrics_by_app: Dict[str, Set[str]] = {}
        lookup: Dict[str, str] = {}
    
        for entry in entries:
            app_hint = entry.get("appid") or entry.get("appId") or entry.get("application")
            metric_hint = entry.get("metricname") or entry.get("metricName") or entry.get("metric_name")
            if not app_hint or not metric_hint:
                continue
    
            app_name = str(app_hint).strip()
            metric_name = str(metric_hint).strip()
            if not app_name or not metric_name:
                continue
    
            if _is_excluded_app(app_name):
                continue
    
            metrics_by_app.setdefault(app_name, set()).add(metric_name)
            lookup.setdefault(_normalize_app_key(app_name), app_name)
    
        catalog = {app: sorted(values) for app, values in metrics_by_app.items()}
    
        # Ensure canonical entries exist even when AMS metadata is sparse.
        for canonical in APP_SYNONYMS.keys():
            if _is_excluded_app(canonical):
                continue
            lower = _normalize_app_key(canonical)
            lookup.setdefault(lower, canonical)
            catalog.setdefault(canonical, [])
    
        for excluded in list(catalog.keys()):
            if _is_excluded_app(excluded):
                catalog.pop(excluded, None)
                lookup.pop(_normalize_app_key(excluded), None)
    
        _DYNAMIC_CATALOG_CACHE = {
            "timestamp": now,
            "catalog": catalog,
            "lookup": lookup,
        }
    
        return catalog, lookup
  • Curated list of prioritized Ambari metric appIds used as fallback when bulk metadata query returns empty.
    CURATED_METRIC_APP_IDS = [
        "ambari_server",
        "namenode",
        "datanode",
        "nodemanager",
        "resourcemanager",
    ]
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions optional metric counts but does not disclose critical traits such as whether this is a read-only operation, potential rate limits, authentication needs, or what 'discovered' entails (e.g., cached vs. real-time data). The 'refresh' parameter hints at caching behavior, but this is not explained in the description.

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?

The description is a single, efficient sentence that front-loads the core purpose ('Return discovered AMS appIds') and adds optional detail. There is no wasted verbiage, making it easy for an agent to parse quickly.

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

Completeness3/5

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

Given 3 parameters with 0% schema coverage, no annotations, and an output schema (which reduces need to describe returns), the description is minimally adequate. It covers the basic purpose but lacks details on parameters, behavioral context, and usage guidelines, leaving gaps that could hinder effective tool selection and invocation.

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

Parameters3/5

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

Schema description coverage is 0%, so the description must compensate but only partially does. It mentions 'optionally with metric counts,' which relates to the 'include_counts' parameter, but does not explain 'refresh' or 'limit.' With 3 parameters and low coverage, the description adds some meaning (for 'include_counts') but leaves others undocumented, meeting the baseline for minimal compensation.

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

Purpose4/5

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

The description clearly states the action ('Return discovered AMS appIds') and resource ('AMS appIds'), with optional metric counts. It distinguishes from siblings like 'list_ambari_metrics_metadata' or 'query_ambari_metrics' by focusing on app discovery rather than metadata or querying, though not explicitly named. However, it lacks full specificity about what 'AMS' refers to (Ambari Metrics System).

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 guidance on when to use this tool versus alternatives like 'list_ambari_metrics_metadata' or 'query_ambari_metrics' is provided. The description implies usage for discovering appIds, but does not specify prerequisites, context, or exclusions, leaving the agent to infer based on tool names alone.

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/call518/MCP-Ambari-API'

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