Tact — 132 Operations for AI Agents
Tact contracts run on TON, where message-passing and gas discipline shape every design. act101 gives agents the contract's receivers, getters, and structs as a map, so on-chain logic stays navigable.
This page is the canonical reference an AI coding agent uses to refactor, query, and analyze Tact code through the act MCP server. 132 operations available: 58 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.
Premium language. Operations on Tact require an Elite license or above. See pricing.
Worked Tact examples
act101 parses Tact with the tree-sitter grammar and edits contracts, structs, and messages as syntax nodes, so a modifier change or a field addition lands on the exact declaration it targets. It can turn a plain function into an externally-readable getter by adding the get modifier. It can add a new field to an existing struct, contract, or message body. And it can extract a chosen subset of a struct's fields into a new nested struct, replacing them in the original with a single field of the new type. Each example below is the verbatim output of the command shown, run against the file shown.
Convert a function to a getter
balance.tact declares balance as a plain function.
$ act refactor-lang convert_to_getter --file balance.tact --params '{"function_name":"balance","line":1,"column":1}'
Before
fun balance(): Int { 100 }
After
get fun balance(): Int { 100 }
get is inserted before fun, making balance externally readable.
Add a field to a struct
point.tact's Point struct has x and y fields.
$ act refactor-lang add_field --file point.tact --params '{"container_name":"Point","field_name":"z","field_type":"Int","line":1,"column":1}'
Before
struct Point { x: Int; y: Int; }
After
struct Point { x: Int; y: Int; z: Int; }
A z: Int field is appended to Point's field list.
Extract fields into a nested struct
account.tact's Account struct mixes an identity field (owner), a mutable counter (nonce), and a balance in one flat declaration.
$ act refactor-lang extract_struct --file account.tact --params '{"struct_name":"Account","new_struct_name":"AccountMeta","new_field_name":"meta","field_names":["owner","nonce"],"line":1,"column":1}'
Before
struct Account { owner: Address; balance: Int; nonce: Int; }
After
struct AccountMeta { owner: Address; nonce: Int; }
struct Account { meta: AccountMeta; balance: Int; }
owner and nonce move into a new AccountMeta struct; Account keeps balance and gains a single meta: AccountMeta field in their place.
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 |
|---|---|
add-bounced-handler |
Insert a bounced handler for a message into a Tact contract body. |
add-constant |
Add a top-level Tact constant declaration. |
add-field |
Add a field to a Tact struct/contract/message body. |
add-gas-check |
Insert an acceptMessage() gas-acceptance call at the start of a Tact function body. |
add-init-parameter |
Add a parameter to a Tact contract's init signature and a matching self-assignment, creating init if absent. |
add-opcode-annotation |
Add or update the message(opcode) annotation on a Tact message type. |
add-receiver |
Insert a receive handler for a message into a Tact contract body. |
change-opcode |
Change an existing message opcode value on a Tact message type. |
convert-getter-to-internal |
Convert a Tact getter function back to internal by removing the get modifier. |
convert-map-to-structs |
Replace a Tact map<K,V> field with a field typed as a struct declared in the same file. Refuses when that struct is not declared in the file, when the map field's name occurs outside its declaration (e.g. `msg.items`, a construction argument, a same-name binding or field), when the owning struct or message's name occurs outside its declaration, type positions and receive() parameter types (a construction would lack the replaced field), when either name occurs in another .tact file under the workspace root, or when the file does not parse. |
convert-message-to-struct |
Convert a Tact message into a struct by dropping the opcode and changing the keyword. Refuses when the message's name occurs anywhere but its own declaration, a type position (a struct/message field, a contract or trait storage variable or constant, a let, a parameter inside a parenthesised parameter list, the result of a `fun` or `get fun` — not of an asm or native function — a map key or value, an optional) or a construction `Msg{…}` — so a top-level `const` typed with it refuses, and in particular a receive/bounced/external parameter, `bounced<Msg>` or `Msg.opcode()`/`Msg.fromCell(…)`, which admit only a message; when the name occurs in another .tact file under the workspace root; or when the file does not parse. |
convert-send-parameters-to-builder |
Introduce a beginCell()-constructed body field into a Tact SendParameters instance inside a send() call. |
convert-struct-to-message |
Convert a Tact struct into a message by inserting an opcode and changing the keyword. |
convert-to-getter |
Convert a Tact function into an externally-readable getter by adding the get modifier. |
convert-to-map |
Convert named fields of the file's first Tact struct into a single map<K,V> field. Refuses when a converted field's name occurs outside the struct declaration (a field access, a construction argument, a destructure, a same-name binding or field), when the struct's name occurs outside its declaration and type positions (a construction `S{…}` would lack the map field), when either name occurs in another .tact file under the workspace root, when the file does not parse, or when `map_name` equals a field that remains in the struct (it would commit a duplicate field). |
convert-to-mixin |
Compose a named Tact trait into the first contract via the with clause. |
extract-function |
Extract selected Tact lines into a new function and replace them with a call. |
extract-mixin |
Move named Tact top-level functions, with their own-line leading comments, into a newly-created trait. Refuses when a moved function's name occurs anywhere but its own declaration (a call site, including recursion or a call from another moved function, since nothing mixes the trait in and a bare call does not resolve inside a trait; or a same-name binding), when the name occurs in another .tact file under the workspace root, when the file does not parse, or when `trait_name` is already declared as a top-level struct, message, contract, trait or primitive in the file or occurs in another .tact file (it would commit a duplicate declaration). |
extract-struct |
Extract selected fields from a Tact struct into a new nested struct. Refuses when a moved field's name occurs outside the struct declaration (a field access, a construction argument, a destructure, a same-name binding or field), when the struct's name occurs outside its declaration and type positions (a construction `S{…}` would lack the new field), when either name occurs in another .tact file under the workspace root, when the file does not parse, when `new_struct_name` is already declared as a top-level struct, message, contract, trait or primitive in the file or occurs in another .tact file, or when `new_field_name` equals a field that remains in the struct (either would commit a duplicate declaration). |
extract-to-contract |
Move named top-level Tact declarations (struct/message/const/function) into a new contract body. |
extract-to-trait |
Extract selected Tact functions' declarations into a new top-level trait. |
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)] |
fix-bounced-handler-signature |
Correct a Tact contract's bounced() parameter type to a given message type. |
fix-gas-limit-exceeded |
Insert an acceptMessage() gas-acceptance call at the start of a Tact function body. |
fix-invalid-message-opcode |
Set a valid opcode on a Tact message type (add or replace message_value). |
fix-missing-init |
Add an init() to a Tact contract initializing its uninitialized storage fields. |
fix-uninitialized-field |
Initialize a Tact contract's uninitialized storage field in init(). |
gen-contract-scaffold |
Generate a minimal Tact contract scaffold (init/receive/getter stubs). |
gen-deployment-script |
Generate a minimal Tact deployment scaffold contract (Tact has no native deploy syntax). |
gen-dex-pool-contract |
Generate a minimal Tact DEX pool contract scaffold. |
gen-getter-function |
Generate a Tact get-function stub wrapped in a contract. |
gen-jetton-contract |
Generate a minimal Tact Jetton minter scaffold (not TEP-74 complete). |
gen-message-definition |
Generate a Tact message(opcode) type definition scaffold. |
gen-multisig-contract |
Generate a minimal Tact multisig wallet scaffold. |
gen-nft-contract |
Generate a minimal Tact NFT collection scaffold (not TEP-62 complete). |
gen-receiver-function |
Generate a Tact receive() handler stub for a message, wrapped in a contract. |
gen-test-scaffold |
Generate a minimal Tact test scaffold contract (Tact has no native test syntax). |
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: it walks the workspace for references and refuses, naming the file, when it cannot read every candidate file; a language server makes the reference set exact. Params: file (string), symbol (string) [, line (u32), column (u32), preview (bool), receipt (bool)]. line alone resolves the symbol's one declaration on that line (refused when the line declares none or several of the name); line + column pinpoints its name |
inline-function |
Inline a simple single-expression Tact function at its same-file call sites. |
inline-struct |
Inline a single-use Tact struct's fields into its parent struct. |
inline-trait |
Inline a Tact trait's member functions to top level and remove the trait declaration. |
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: it walks the workspace for references and refuses, naming the file, when it cannot read every candidate file; a language server makes the reference set exact. 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-bounced-handler |
Remove the bounced handler for a message from a Tact contract. |
remove-constant |
Remove a top-level Tact constant and substitute same-file references with its value. |
remove-field |
Remove an unused field from a Tact struct/contract/message body. |
remove-gas-check |
Remove an acceptMessage() gas-acceptance call from a Tact function body. |
remove-init-parameter |
Remove a parameter from a Tact contract's init signature and its matching self-assignment. |
remove-receiver |
Remove the receive handler for a message from a Tact contract. |
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: it renames across the workspace and refuses, naming the file, when it cannot read every candidate file; a language server makes the reference set exact. Params: file (string), old_name (string), new_name (string) [, line (u32), column (u32), preview (bool), receipt (bool)]. line alone resolves the symbol's one declaration on that line (refused when the line declares none or several of the name); line + column pinpoints its name |
rename-contract |
Rename a Tact contract and same-file references. |
rename-field |
Rename a Tact struct/contract/message field and same-file access/instance sites. |
rename-function |
Rename a Tact function and same-file direct call sites. |
rename-message |
Rename a Tact message and same-file type/constructor references. |
rename-struct |
Rename a Tact struct and same-file type/constructor references. |
reorder-fields |
Reorder the fields of a Tact struct/contract/message into a new order. |
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