Bicep — 100 Operations for AI Agents
Bicep is Azure infrastructure as code without the ARM JSON — resources, modules, parameters in readable form. act101 navigates those declarations structurally, so agents trace what a deployment actually provisions.
This page is the canonical reference an AI coding agent uses to refactor, query, and analyze Bicep code through the act MCP server. 100 operations available: 26 refactor, 18 query, 42 analysis, 14 verification. 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 Bicep examples
act101 edits Bicep templates the way Azure IaC authors would: it can extract a hardcoded resource property into a top-level param and rewire the resource to reference it, or delete a param declaration that no resource in the file references at all. It can also reorder a file's param or output declarations alphabetically, leaving the resource block that references them untouched, and remove a var declaration nothing in the file reads. Every operation in this deck edits a top-level param, var, or output declaration — extracting one, reordering a set of them, or deleting one nothing references — while the resource block that consumes them stays untouched. Each example below is the verbatim output of the command shown, run against the file shown.
Extract a hardcoded value into a parameter
sa's location is hardcoded to 'eastus', so redeploying to another region means editing the resource body directly.
$ act refactor-lang extract_parameter --file storageAccount.bicep --params '{"param_name":"location","param_type":"string","value":"'"'"'eastus'"'"'","line":3,"column":1,"symbol":"sa"}'
Before
resource sa 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'mystorage'
location: 'eastus'
sku: { name: 'Standard_LRS' }
kind: 'StorageV2'
}
After
param location string = 'eastus'
resource sa 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'mystorage'
location: location
sku: { name: 'Standard_LRS' }
kind: 'StorageV2'
}
A param location string = 'eastus' declaration is added above the resource, and the resource's location: property now reads location instead of the literal string.
Reorder parameters alphabetically
skuName, environment, and location are declared in the order they were first needed, not alphabetically.
$ act refactor-lang reorder_parameters --file deploy.bicep --params '{"line":1,"column":1}'
Before
param skuName string
param environment string
param location string
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'st${environment}'
location: location
kind: 'StorageV2'
sku: {
name: skuName
}
}
After
param environment string
param location string
param skuName string
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'st${environment}'
location: location
kind: 'StorageV2'
sku: {
name: skuName
}
}
The three param declarations are reordered to environment, location, skuName; the resource block that references them is untouched.
Remove an unused parameter
storageDeploy.bicep declares an unusedTag parameter that no resource in the file references.
$ act refactor-lang remove_unused_parameter --file storageDeploy.bicep --params '{"param_name":"unusedTag","line":2,"column":7,"symbol":"unusedTag"}'
Before
param location string
param unusedTag string
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'staccount01'
location: location
kind: 'StorageV2'
sku: {
name: 'Standard_LRS'
}
}
After
param location string
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'staccount01'
location: location
kind: 'StorageV2'
sku: {
name: 'Standard_LRS'
}
}
The param unusedTag string declaration is deleted; the location parameter and the storageAccount resource that references it are untouched.
Reorder outputs alphabetically
keyVault.bicep's Microsoft.KeyVault/vaults resource declares vaultUri, resourceId, and keyVaultName outputs in that order.
$ act refactor-lang reorder_outputs --file keyVault.bicep --params '{"line":16,"column":1}'
Before
param location string
resource keyVault 'Microsoft.KeyVault/vaults@2023-07-01' = {
name: 'kv-myapp'
location: location
properties: {
sku: {
family: 'A'
name: 'standard'
}
tenantId: subscription().tenantId
}
}
output vaultUri string = keyVault.properties.vaultUri
output resourceId string = keyVault.id
output keyVaultName string = keyVault.name
After
param location string
resource keyVault 'Microsoft.KeyVault/vaults@2023-07-01' = {
name: 'kv-myapp'
location: location
properties: {
sku: {
family: 'A'
name: 'standard'
}
tenantId: subscription().tenantId
}
}
output keyVaultName string = keyVault.name
output resourceId string = keyVault.id
output vaultUri string = keyVault.properties.vaultUri
The three output declarations are reordered to keyVaultName, resourceId, vaultUri; the keyVault resource block above them is untouched.
Remove an unused variable
storage.bicep declares a complexConfig object variable — tier, replication, accessTier, minimumTlsVersion — that nothing in the file reads.
$ act refactor-lang remove_unused_variable --file storage.bicep --params '{"variable_name":"complexConfig","line":3,"column":5,"symbol":"complexConfig"}'
Before
param location string
var complexConfig = {
tier: 'Standard'
replication: 'LRS'
accessTier: 'Hot'
minimumTlsVersion: 'TLS1_2'
}
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'staccount01'
location: location
kind: 'StorageV2'
sku: {
name: 'Standard_LRS'
}
}
After
param location string
resource storageAccount 'Microsoft.Storage/storageAccounts@2023-01-01' = {
name: 'staccount01'
location: location
kind: 'StorageV2'
sku: {
name: 'Standard_LRS'
}
}
The var complexConfig = { ... } declaration is deleted; the location parameter and the storageAccount resource are untouched.
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
Refactor
| Operation | Description |
|---|---|
extract-module |
Group related resources into a module |
extract-output |
Extract resource property into output |
extract-parameter |
Extract hardcoded value into parameter |
extract-variable |
Extract expression into named variable |
extract_function |
Extract a code selection into a new function — automatically infers parameters, return types, and inserts the call site. Use instead of manually cutting/pasting code. Works without LSP; LSP improves type inference. Params: file (string), new_name (string), start_line (u32), start_column (u32), end_line (u32), end_column (u32) [, preview (bool), receipt (bool)] |
extract_variable |
Extract an expression into a named variable — inserts the declaration and replaces the expression with the variable name. Works without LSP. Params: file (string), new_name (string), start_line (u32), start_column (u32), end_line (u32), end_column (u32) [, preview (bool)] |
generate-imports |
Add import statements for referenced modules |
generate-module-scaffold |
Create module file with parameters/outputs skeleton |
generate-variable |
Generate variable from expression or value |
inline |
Inline a variable, function, or method — replace every usage with its definition body, then remove the original. The inverse of extract. Works without LSP (single-file); LSP enables cross-file inlining. Params: file (string), symbol (string) [, line (u32), preview (bool), receipt (bool)] |
inline-variable |
Replace variable reference with its value |
insert_body |
Replace a function's implementation body with new code. AST-validated — rejects if the result has parse errors, so you can't accidentally break syntax. Use instead of manual text editing for function rewrites. Params: file (string), symbol (string), code (string) [, commit (bool)] |
move_symbol |
Move a function, class, or type to a different file and automatically update all imports across the codebase. Use instead of manually cut/paste + fixing imports. Works without LSP (single-file); LSP enables cross-file import updates. Params: file (string), symbol (string), destination (string) [, preview (bool), receipt (bool)] |
recipe_run |
Run a codemod recipe: declarative match → transform → optional verify across modeled grammars. Preview lists matches; apply writes with optional E7 receipts and all-or-nothing rollback. Returns a per-site report. |
remove-unused-parameter |
Delete parameter not referenced in file |
remove-unused-variable |
Delete variable not referenced in file |
rename |
Rename a symbol and automatically update ALL references across the codebase. Safer and faster than find-and-replace — AST-aware, won't rename strings or comments. Works without LSP (single-file); LSP enables cross-file renames. Params: file (string), old_name (string), new_name (string) [, line (u32), column (u32), preview (bool), receipt (bool)] |
rename-module |
Rename a module and update all references |
rename-output |
Rename an output and update all references |
rename-parameter |
Rename a parameter and update all references |
rename-resource |
Rename a resource and update all symbolic references |
rename-variable |
Rename a variable and update all references |
reorder-outputs |
Sort outputs alphabetically |
reorder-parameters |
Sort parameters alphabetically |
reorder-resources |
Sort resources by type or alphabetically |
reorder-variables |
Sort variables alphabetically |
Analysis
42 analysis tools, the same on every supported language. Descriptions live in the shared reference: /docs/analysis-tools.
analyze_api_diff analyze_chokepoints analyze_clones analyze_clusters analyze_cohesion analyze_conformance analyze_coupling analyze_cycle_risk analyze_cycles analyze_dead_code analyze_depth analyze_entry_points analyze_export analyze_extraction analyze_fan_balance analyze_features analyze_hotspots analyze_impact analyze_inconsistencies analyze_inheritance analyze_interface_bloat analyze_interfaces analyze_layers analyze_orphan_types analyze_patterns analyze_platform_deps analyze_readiness analyze_roles analyze_seams analyze_stability analyze_surface analyze_test_gaps analyze_thickness analyze_type_completeness churn_hotspots co_change_clusters coverage_overlay ownership_map profile_overlay simulate split_module trace_overlay
Verify
14 verify tools, the same on every supported language. Descriptions live in the shared reference: /docs/verification.
bisect_regression gate generate_test_harness scan secret_surface summarize_pr taint_flow unsafe_surface verify_behavioral_equivalence verify_contract_preserved verify_diff_semantics verify_port_parity verify_side_effects verify_test_impact