Skip to main content
Glama

Opsphere — DevOps & SRE Intelligence

Count Containers in Cluster

k8s_containers_count
Read-only

Returns the total number of containers (not pods) across ALL namespaces in the cluster, including init containers. Does NOT accept a namespace filter — it always counts cluster-wide. The "byNamespace" field in the result shows every namespace independently, not a single one. For namespace-specific pod counts, use k8s_pods_list instead. Returns total, breakdown by namespace (byNamespace), by pod phase, and separation between regular and init containers.

Input Schema

NameRequiredDescriptionDefault
contextNokubectl --context opcional
profileNoAWS_PROFILE opcional para EKS/SSO
context_idNoOptional explicit Connection Hub work context (ctx_*). Omit to use the conversation's active workspace; global Hub tools ignore it.
environment_slugNoCloud catalog environment slug or alias (resolves AWS profile and kubectl context)

Output Schema

NameRequiredDescriptionDefault
okYes
dataYes
contractVersionYes
dataSchemaVersionYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed21 schema fields changed
    • changedOutput schema / properties / data / additionalProperties
      Previous value: -trueNew value: +false
    • removedOutput schema / properties / data / properties / apiVersion
      Removed value: -{
      -  "type": "string"
      -}
    • addedOutput schema / properties / data / properties / byNamespace
      Added value: +{
      +  "additionalProperties": {
      +    "minimum": 0,
      +    "type": "integer"
      +  },
      +  "type": "object"
      +}
    • addedOutput schema / properties / data / properties / byPhase
      Added value: +{
      +  "additionalProperties": {
      +    "minimum": 0,
      +    "type": "integer"
      +  },
      +  "type": "object"
      +}
    • removedOutput schema / properties / data / properties / context
      Removed value: -{
      -  "type": "string"
      -}
    • removedOutput schema / properties / data / properties / count
      Removed value: -{
      -  "type": "number"
      -}
    • addedOutput schema / properties / data / properties / gaps
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / data / properties / initContainers
      Added value: +{
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • removedOutput schema / properties / data / properties / items
      Removed value: -{
      -  "items": {
      -    "additionalProperties": true,
      -    "properties": {},
      -    "type": "object"
      -  },
      -  "type": "array"
      -}
    • removedOutput schema / properties / data / properties / kind
      Removed value: -{
      -  "type": "string"
      -}
    • removedOutput schema / properties / data / properties / metadata
      Removed value: -{
      -  "$ref": "#/properties/data/properties/items/items"
      -}
    • removedOutput schema / properties / data / properties / namespace
      Removed value: -{
      -  "type": "string"
      -}
    • addedOutput schema / properties / data / properties / partial
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / data / properties / regularContainers
      Added value: +{
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • removedOutput schema / properties / data / properties / status
      Removed value: -{
      -  "$ref": "#/properties/data/properties/items/items"
      -}
    • addedOutput schema / properties / data / properties / total
      Added value: +{
      +  "minimum": 0,
      +  "type": "integer"
      +}
    • addedOutput schema / properties / data / properties / truncated
      Added value: +{
      +  "type": "boolean"
      +}
    • addedOutput schema / properties / data / properties / warnings
      Added value: +{
      +  "items": {
      +    "type": "string"
      +  },
      +  "type": "array"
      +}
    • addedOutput schema / properties / data / required
      Added value: +[
      +  "total",
      +  "regularContainers",
      +  "initContainers",
      +  "byNamespace",
      +  "byPhase",
      +  "partial",
      +  "truncated",
      +  "warnings",
      +  "gaps"
      +]
    • addedOutput schema / properties / dataSchemaVersion
      Added value: +{
      +  "const": 2,
      +  "type": "number"
      +}
    • changedOutput schema / required
      Previous value: -[
      -  "contractVersion",
      -  "ok",
      -  "data"
      -]New value: +[
      +  "contractVersion",
      +  "dataSchemaVersion",
      +  "ok",
      +  "data"
      +]
  2. First observed

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so safety is covered; the description adds real behavioral context: always cluster-wide, includes init containers, and how 'byNamespace' should be interpreted. It stops short of mentioning cost/latency of a cluster-wide scan, which would be useful at scale.

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

Conciseness4/5

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

Four sentences, front-loaded with the core scope constraint, and every sentence carries routing or interpretation value. The trailing enumeration of return fields is mildly redundant given an output schema exists.

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

Completeness5/5

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

Covers scope, exclusions, the sibling alternative, and the shape of the result, on top of annotations that declare it a safe read and an output schema that defines return structure. Nothing an agent needs in order to call it correctly is missing.

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 coverage is 100%, so the four optional auth/context parameters (context, profile, context_id, environment_slug) are already documented in the schema. The description adds only a negative statement about a namespace parameter that does not exist, contributing nothing about the parameters that do.

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?

States a specific verb and resource ('Returns the total number of containers') with explicit scope ('across ALL namespaces') and a clarifying parenthetical ('not pods') plus init-container inclusion. An agent can distinguish this from pod-counting siblings without opening any schema.

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

Usage Guidelines5/5

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

Explicitly names a non-capability ('Does NOT accept a namespace filter') and routes to the alternative ('For namespace-specific pod counts, use k8s_pods_list instead'). Both the when and the when-not are stated.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources