WIT — 18 Operations for AI Agents
WIT files define WebAssembly component interfaces — the contracts that make Wasm modules composable across languages. act101 maps worlds, interfaces, and types as structure, so agents work at the component boundary precisely.
This page is the canonical reference an AI coding agent uses to refactor, query, and analyze WIT 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 WIT examples
act101 reads a WIT package's interface and world blocks as top-level declarations — an interface comes back kind interface, a world comes back kind class, the closest kind the vocabulary has for a component's assembly unit. symbols reaches one level deeper, into an interface's own record/enum/variant/flags/resource/type items and its func items, but derives the world's kind independently rather than reusing skeleton's stated one, so the same world block is reported differently by the two commands. The unit of structure in this grammar is the interface or world; neither query reads a function's own parameter list. 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 the package's interfaces and world as a skeleton
payment-terminal.wit describes a card-reader component: a logging interface the world imports, a card-reader interface it exports, and the payment-terminal world that wires them together.
$ act query skeleton payment-terminal.wit
Before
package acme:payments;
interface logging {
log: func(msg: string);
}
interface card-reader {
record transaction {
card-last-four: string,
amount-cents: u32,
}
enum terminal-status {
idle,
reading,
declined,
}
read-card: func() -> transaction;
authorize: func(t: transaction) -> bool;
}
world payment-terminal {
import logging;
export card-reader;
}
Output
{
"type": "Skeleton",
"declarations": [
{
"kind": "interface",
"name": "logging",
"range": {
"start": {
"file": "payment-terminal.wit",
"line": 3,
"column": 1,
"byte_offset": 24
},
"end": {
"file": "payment-terminal.wit",
"line": 5,
"column": 2,
"byte_offset": 71
}
},
"name_range": {
"start": {
"file": "payment-terminal.wit",
"line": 3,
"column": 11,
"byte_offset": 34
},
"end": {
"file": "payment-terminal.wit",
"line": 3,
"column": 18,
"byte_offset": 41
}
}
},
{
"kind": "interface",
"name": "card-reader",
"range": {
"start": {
"file": "payment-terminal.wit",
"line": 7,
"column": 1,
"byte_offset": 73
},
"end": {
"file": "payment-terminal.wit",
"line": 21,
"column": 2,
"byte_offset": 323
}
},
"name_range": {
"start": {
"file": "payment-terminal.wit",
"line": 7,
"column": 11,
"byte_offset": 83
},
"end": {
"file": "payment-terminal.wit",
"line": 7,
"column": 22,
"byte_offset": 94
}
}
},
{
"kind": "class",
"name": "payment-terminal",
"range": {
"start": {
"file": "payment-terminal.wit",
"line": 23,
"column": 1,
"byte_offset": 325
},
"end": {
"file": "payment-terminal.wit",
"line": 26,
"column": 2,
"byte_offset": 391
}
},
"name_range": {
"start": {
"file": "payment-terminal.wit",
"line": 23,
"column": 7,
"byte_offset": 331
},
"end": {
"file": "payment-terminal.wit",
"line": 23,
"column": 23,
"byte_offset": 347
}
}
}
]
}
The skeleton reports three declarations: logging and card-reader both as interface, and payment-terminal as class — the world block's records, enums, and functions are not read at this level.
List the interface's types and functions alongside the world
card-reader defines a transaction record, a terminal-status enum, and two functions, read-card and authorize; logging defines one function, log.
$ act query symbols payment-terminal.wit
Before
package acme:payments;
interface logging {
log: func(msg: string);
}
interface card-reader {
record transaction {
card-last-four: string,
amount-cents: u32,
}
enum terminal-status {
idle,
reading,
declined,
}
read-card: func() -> transaction;
authorize: func(t: transaction) -> bool;
}
world payment-terminal {
import logging;
export card-reader;
}
Output
{
"type": "Symbols",
"symbols": [
{
"name": "logging",
"kind": "interface",
"range": {
"start": {
"file": "payment-terminal.wit",
"line": 3,
"column": 11,
"byte_offset": 34
},
"end": {
"file": "payment-terminal.wit",
"line": 3,
"column": 18,
"byte_offset": 41
}
},
"visibility": "unknown"
},
{
"name": "log",
"kind": "function",
"range": {
"start": {
"file": "payment-terminal.wit",
"line": 4,
"column": 3,
"byte_offset": 46
},
"end": {
"file": "payment-terminal.wit",
"line": 4,
"column": 6,
"byte_offset": 49
}
},
"visibility": "unknown"
},
{
"name": "card-reader",
"kind": "interface",
"range": {
"start": {
"file": "payment-terminal.wit",
"line": 7,
"column": 11,
"byte_offset": 83
},
"end": {
"file": "payment-terminal.wit",
"line": 7,
"column": 22,
"byte_offset": 94
}
},
"visibility": "unknown"
},
{
"name": "transaction",
"kind": "struct",
"range": {
"start": {
"file": "payment-terminal.wit",
"line": 8,
"column": 10,
"byte_offset": 106
},
"end": {
"file": "payment-terminal.wit",
"line": 8,
"column": 21,
"byte_offset": 117
}
},
"visibility": "unknown"
},
{
"name": "terminal-status",
"kind": "enum",
"range": {
"start": {
"file": "payment-terminal.wit",
"line": 13,
"column": 8,
"byte_offset": 183
},
"end": {
"file": "payment-terminal.wit",
"line": 13,
"column": 23,
"byte_offset": 198
}
},
"visibility": "unknown"
},
{
"name": "read-card",
"kind": "function",
"range": {
"start": {
"file": "payment-terminal.wit",
"line": 19,
"column": 3,
"byte_offset": 245
},
"end": {
"file": "payment-terminal.wit",
"line": 19,
"column": 12,
"byte_offset": 254
}
},
"visibility": "unknown"
},
{
"name": "authorize",
"kind": "function",
"range": {
"start": {
"file": "payment-terminal.wit",
"line": 20,
"column": 3,
"byte_offset": 281
},
"end": {
"file": "payment-terminal.wit",
"line": 20,
"column": 12,
"byte_offset": 290
}
},
"visibility": "unknown"
},
{
"name": "payment-terminal",
"kind": "unknown",
"range": {
"start": {
"file": "payment-terminal.wit",
"line": 23,
"column": 7,
"byte_offset": 331
},
"end": {
"file": "payment-terminal.wit",
"line": 23,
"column": 23,
"byte_offset": 347
}
},
"visibility": "unknown"
}
],
"parse_error": true
}
symbols adds transaction as struct, terminal-status as enum, and all three functions as function, for eight entries total — but reports payment-terminal as kind: unknown, disagreeing with the skeleton's class for the identical world block.
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