Skip to main content
Glama

Code context

code_context
Read-only

The runtime context a coding agent needs to fix a workload's code, in one compact read. For a Deployment, StatefulSet, DaemonSet or Pod it returns: (1) each container's image and digest mapped to the commit it was built from - repository owner/name, branch and full sha - from Ankra Pipelines publish records (the immutable sha- tag or the digest) or the Ankra application installed in the namespace, else the image's own org.opencontainers.image.revision label (via oci_label), else commit.state unresolved or ambiguous with the reason; (2) when the running revision started (its ReplicaSet or ControllerRevision) and the previous revision's images and commits; (3) the error lines in the running revision's container logs, including the previous (crashed) instance of a restarting container, grouped by fingerprint (numbers, ids and timestamps stripped) with counts, samples and before_deploy: seen, not_seen or unknown in the log store's window before the deploy; (4) the stack frames in those lines (Go, Python, Node, Java) as repository-relative file:line guesses with a link to the line at the deployed commit; (5) restarts and the last termination (OOMKilled, Error, exit code) per container. Call it FIRST when asked to fix, debug or explain a crashing or erroring service in code, when asked which commit a workload runs, or before handing a production error to a coding agent, then read the named files at the named commit. An unknown or unresolved part is a read that did not happen, never a finding. Read-only; secrets in log lines are redacted; the result stays under 8 KB.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "namespace": "<namespace>",
      "name": "<name>",
      "cluster_id": "<cluster_id>"
    },
    "name": "code_context"
  }
}

Input Schema

NameRequiredDescriptionDefault
kindNoKind of the named workload. Optional: Deployment, StatefulSet, DaemonSet and Pod are tried in that order when omitted.
nameYesName of the Deployment, StatefulSet, DaemonSet or Pod. A pod name is followed to its controller.
containerNoRead only this container's image and logs. Optional; every container of the pod template by default.
namespaceYesNamespace of the workload.
cluster_idYesAnkra cluster id (UUID) the call targets. Discover ids with list_clusters.
max_samplesNoSample lines kept per error fingerprint (default 2, max 5).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Added

TDQS

A4.4/5.0
Behavior5/5

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

Annotations only declare readOnlyHint; the description adds substantial behavioral context beyond that: secrets in log lines are redacted, the result is bounded under 8 KB, and unresolved lookups are explicitly framed as failed reads rather than findings. It also discloses the resolution cascade (Ankra Pipelines publish records → installed application → oci_label → unresolved/ambiguous) so the agent understands what a partial answer means.

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?

Purpose is front-loaded, the five return components are numbered for scanability, and usage guidance closes the block. The individual sentences are extremely long and heavily nested, which costs some readability, but each clause carries distinct information (fallbacks, fingerprint grouping, before_deploy states) rather than filler.

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?

There is no output schema, so the description must carry the full return contract, and it does: it specifies all five result sections, the fingerprinting/normalization rule, supported stack-frame languages, and the before_deploy tri-state. For a tool this complex with three required parameters, nothing essential for correct invocation 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 description coverage is 100% and the schema already explains kind ordering, pod-name-to-controller following, container filtering, and max_samples default/max. The description adds no parameter-level detail beyond that (e.g., no guidance on when to pass container or when the kind fallback matters), so the baseline 3 applies.

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?

The description states a specific verb and resource with its scope: the runtime context (image→commit, revision history, error fingerprints, stack frames, restarts) for a Deployment, StatefulSet, DaemonSet or Pod. Each of the five returned components is enumerated, so an agent knows exactly what this tool produces versus generic log or resource readers.

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?

It gives explicit triggering conditions ('call it FIRST when asked to fix, debug or explain a crashing or erroring service', 'when asked which commit a workload runs') and a follow-on step ('then read the named files at the named commit'). It does not name when-not to use it or point at competing siblings like get_pod_logs or query_logs, so the alternative selection is inferred rather than 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.