JSONnet — 18 Operations for AI Agents
JSONnet generates the configuration other tools consume — Kubernetes objects, Grafana dashboards, templated environments. act101 navigates functions and field overrides structurally, so agents follow how the final config gets composed.
This page is the canonical reference an AI coding agent uses to refactor, query, and analyze JSONnet code through the act MCP server. 18 operations available: 0 refactor, 18 query, 0 analysis. Each operation is callable from Claude Code, Cursor, Codex, OpenCode, or any MCP-compatible agent host. Click any operation for a stable anchor link suitable for citation.
Worked JSONnet examples
act101 reads a JSONnet file's local bindings, not just its object fields: a local that binds a function surfaces in the skeleton as both a variable (the name binding) and a function (its parameter list), while a local that binds a plain value, an object comprehension key, or an ordinary object field surfaces as a variable or field. symbols reports the same bindings by name and kind, including a function's own parameters. The unit of structure in this grammar is the local binding and the object field, both of which JSONnet's functions and comprehensions can generate at evaluation time rather than list literally in the source. Each example below is the verbatim output of the command shown, run against the file shown. Query outputs are pretty-printed with the timing block omitted.
Read locals, functions, and fields as a skeleton
deployments.jsonnet computes per-service CPU and memory limits: a local function resourceLimits picks a tier, and an object comprehension builds one deployments entry per entry in the services array.
$ act query skeleton deployments.jsonnet
Before
local resourceLimits(tier) = {
cpu: if tier == "high" then "2000m" else "500m",
memory: if tier == "high" then "4Gi" else "512Mi",
};
local services = ["checkout", "inventory", "pricing"];
{
namespace: "storefront",
deployments: {
[svc]: {
replicas: if svc == "checkout" then 4 else 2,
resources: resourceLimits(if svc == "checkout" then "high" else "low"),
}
for svc in services
},
}
Output
{
"type": "Skeleton",
"declarations": [
{
"kind": "variable",
"name": "resourceLimits",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 1,
"column": 1,
"byte_offset": 0
},
"end": {
"file": "deployments.jsonnet",
"line": 17,
"column": 2,
"byte_offset": 420
}
},
"name_range": {
"start": {
"file": "deployments.jsonnet",
"line": 1,
"column": 7,
"byte_offset": 6
},
"end": {
"file": "deployments.jsonnet",
"line": 1,
"column": 21,
"byte_offset": 20
}
}
},
{
"kind": "function",
"name": "resourceLimits",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 1,
"column": 1,
"byte_offset": 0
},
"end": {
"file": "deployments.jsonnet",
"line": 17,
"column": 2,
"byte_offset": 420
}
},
"name_range": {
"start": {
"file": "deployments.jsonnet",
"line": 1,
"column": 7,
"byte_offset": 6
},
"end": {
"file": "deployments.jsonnet",
"line": 1,
"column": 21,
"byte_offset": 20
}
}
},
{
"kind": "variable",
"name": "cpu",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 2,
"column": 3,
"byte_offset": 33
},
"end": {
"file": "deployments.jsonnet",
"line": 2,
"column": 50,
"byte_offset": 80
}
},
"name_range": {
"start": {
"file": "deployments.jsonnet",
"line": 2,
"column": 3,
"byte_offset": 33
},
"end": {
"file": "deployments.jsonnet",
"line": 2,
"column": 6,
"byte_offset": 36
}
}
},
{
"kind": "variable",
"name": "memory",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 3,
"column": 3,
"byte_offset": 84
},
"end": {
"file": "deployments.jsonnet",
"line": 3,
"column": 52,
"byte_offset": 133
}
},
"name_range": {
"start": {
"file": "deployments.jsonnet",
"line": 3,
"column": 3,
"byte_offset": 84
},
"end": {
"file": "deployments.jsonnet",
"line": 3,
"column": 9,
"byte_offset": 90
}
}
},
{
"kind": "variable",
"name": "services",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 6,
"column": 1,
"byte_offset": 139
},
"end": {
"file": "deployments.jsonnet",
"line": 17,
"column": 2,
"byte_offset": 420
}
},
"name_range": {
"start": {
"file": "deployments.jsonnet",
"line": 6,
"column": 7,
"byte_offset": 145
},
"end": {
"file": "deployments.jsonnet",
"line": 6,
"column": 15,
"byte_offset": 153
}
}
},
{
"kind": "variable",
"name": "namespace",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 9,
"column": 3,
"byte_offset": 199
},
"end": {
"file": "deployments.jsonnet",
"line": 9,
"column": 26,
"byte_offset": 222
}
},
"name_range": {
"start": {
"file": "deployments.jsonnet",
"line": 9,
"column": 3,
"byte_offset": 199
},
"end": {
"file": "deployments.jsonnet",
"line": 9,
"column": 12,
"byte_offset": 208
}
}
},
{
"kind": "variable",
"name": "deployments",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 10,
"column": 3,
"byte_offset": 226
},
"end": {
"file": "deployments.jsonnet",
"line": 16,
"column": 4,
"byte_offset": 417
}
},
"name_range": {
"start": {
"file": "deployments.jsonnet",
"line": 10,
"column": 3,
"byte_offset": 226
},
"end": {
"file": "deployments.jsonnet",
"line": 10,
"column": 14,
"byte_offset": 237
}
}
},
{
"kind": "variable",
"name": "svc",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 11,
"column": 5,
"byte_offset": 245
},
"end": {
"file": "deployments.jsonnet",
"line": 14,
"column": 6,
"byte_offset": 389
}
},
"name_range": {
"start": {
"file": "deployments.jsonnet",
"line": 11,
"column": 6,
"byte_offset": 246
},
"end": {
"file": "deployments.jsonnet",
"line": 11,
"column": 9,
"byte_offset": 249
}
}
},
{
"kind": "variable",
"name": "replicas",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 12,
"column": 7,
"byte_offset": 260
},
"end": {
"file": "deployments.jsonnet",
"line": 12,
"column": 51,
"byte_offset": 304
}
},
"name_range": {
"start": {
"file": "deployments.jsonnet",
"line": 12,
"column": 7,
"byte_offset": 260
},
"end": {
"file": "deployments.jsonnet",
"line": 12,
"column": 15,
"byte_offset": 268
}
}
},
{
"kind": "variable",
"name": "resources",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 13,
"column": 7,
"byte_offset": 312
},
"end": {
"file": "deployments.jsonnet",
"line": 13,
"column": 77,
"byte_offset": 382
}
},
"name_range": {
"start": {
"file": "deployments.jsonnet",
"line": 13,
"column": 7,
"byte_offset": 312
},
"end": {
"file": "deployments.jsonnet",
"line": 13,
"column": 16,
"byte_offset": 321
}
}
}
]
}
resourceLimits appears twice, once as a variable and once as a function; services, namespace, and deployments are variable declarations, and the comprehension's svc, replicas, and resources each get their own entry.
List every local binding and object field as symbols
resourceLimits takes one parameter, tier, used inside two if expressions to pick a CPU and memory value.
$ act query symbols deployments.jsonnet
Before
local resourceLimits(tier) = {
cpu: if tier == "high" then "2000m" else "500m",
memory: if tier == "high" then "4Gi" else "512Mi",
};
local services = ["checkout", "inventory", "pricing"];
{
namespace: "storefront",
deployments: {
[svc]: {
replicas: if svc == "checkout" then 4 else 2,
resources: resourceLimits(if svc == "checkout" then "high" else "low"),
}
for svc in services
},
}
Output
{
"type": "Symbols",
"symbols": [
{
"name": "resourceLimits",
"kind": "variable",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 1,
"column": 7,
"byte_offset": 6
},
"end": {
"file": "deployments.jsonnet",
"line": 1,
"column": 21,
"byte_offset": 20
}
},
"visibility": "unknown"
},
{
"name": "resourceLimits",
"kind": "variable",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 1,
"column": 7,
"byte_offset": 6
},
"end": {
"file": "deployments.jsonnet",
"line": 1,
"column": 21,
"byte_offset": 20
}
},
"visibility": "unknown"
},
{
"name": "tier",
"kind": "parameter",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 1,
"column": 22,
"byte_offset": 21
},
"end": {
"file": "deployments.jsonnet",
"line": 1,
"column": 26,
"byte_offset": 25
}
},
"visibility": "unknown"
},
{
"name": "cpu",
"kind": "field",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 2,
"column": 3,
"byte_offset": 33
},
"end": {
"file": "deployments.jsonnet",
"line": 2,
"column": 6,
"byte_offset": 36
}
},
"visibility": "unknown"
},
{
"name": "memory",
"kind": "field",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 3,
"column": 3,
"byte_offset": 84
},
"end": {
"file": "deployments.jsonnet",
"line": 3,
"column": 9,
"byte_offset": 90
}
},
"visibility": "unknown"
},
{
"name": "services",
"kind": "variable",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 6,
"column": 7,
"byte_offset": 145
},
"end": {
"file": "deployments.jsonnet",
"line": 6,
"column": 15,
"byte_offset": 153
}
},
"visibility": "unknown"
},
{
"name": "namespace",
"kind": "field",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 9,
"column": 3,
"byte_offset": 199
},
"end": {
"file": "deployments.jsonnet",
"line": 9,
"column": 12,
"byte_offset": 208
}
},
"visibility": "unknown"
},
{
"name": "deployments",
"kind": "field",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 10,
"column": 3,
"byte_offset": 226
},
"end": {
"file": "deployments.jsonnet",
"line": 10,
"column": 14,
"byte_offset": 237
}
},
"visibility": "unknown"
},
{
"name": "svc",
"kind": "field",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 11,
"column": 6,
"byte_offset": 246
},
"end": {
"file": "deployments.jsonnet",
"line": 11,
"column": 9,
"byte_offset": 249
}
},
"visibility": "unknown"
},
{
"name": "replicas",
"kind": "field",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 12,
"column": 7,
"byte_offset": 260
},
"end": {
"file": "deployments.jsonnet",
"line": 12,
"column": 15,
"byte_offset": 268
}
},
"visibility": "unknown"
},
{
"name": "resources",
"kind": "field",
"range": {
"start": {
"file": "deployments.jsonnet",
"line": 13,
"column": 7,
"byte_offset": 312
},
"end": {
"file": "deployments.jsonnet",
"line": 13,
"column": 16,
"byte_offset": 321
}
},
"visibility": "unknown"
}
]
}
symbols lists 11 entries, including tier as a parameter and cpu/memory as field entries nested inside the resourceLimits function body.
Query
18 query tools, the same on every supported language. Descriptions live in the shared reference: /docs/query-tools.
callers control_flow data_flow definition diagnostics effect_closure effect_summary fix_auto get_type graph import_organize interface mutations references repo_outline skeleton symbols symbols_batch