The 2026-11-29 proposal: starting point and plan
View SourceThis page keeps two sections of the design as they were written on 2026-11-29, before any code: what erlang_wasm and barrel_mcp offered on that date, and the phased plan that built wasm_tools 0.1.0. They are history. Most of the gaps they list were closed upstream before 0.1.0 (erlang_wasm 0.15.0, barrel_mcp 4.9.0), so do not read them as the current state. You need this page to know why an upstream change was made, or how the first release was planned. The decisions and their reasons are in the design; in the text below, "this page" means the design as it was then.
1. What exists today (verified in source)
erlang_wasm 0.14.0, supported API unless marked internal:
| need | where | state |
|---|---|---|
| decode once, instantiate many | wasm_component:prepare/1, instantiate/3 | ok |
| typed call | wasm_component:call/4, signature written by hand, not checked against the binary | ok |
| Erlang values | record = map with binary keys, variant {Name, Payload}, enum binary, option none | {some, V}, result {ok, V} | {error, E}, flags [binary()], list<u8> binary, char integer | ok |
| export names | exports/1, top level only | partial |
| export signatures with parameter names | none public. wasm_component_link:resource_info/2 (internal) has sigs; parameter names dropped (wasm_component_types.erl:371); world-level named types stay {typeref, N}; composed components give no sigs; no async flag | missing |
| imports with sigs | wasm_component_types:import_interfaces/1 (internal) | internal |
| custom sections (package-docs) | skipped (wasm_component.erl:237) | missing |
| argument checks | integers masked, not range-checked (wasm_canon.erl:113-125): 256 as u8 becomes 0; UTF-8 and chars unchecked; a wrong shape becomes malformed/internal | bug |
| WASI 0.2, deny by default | wasi_preview2:command/1: no mounts, empty env, stdio discarded, no wasi:sockets without network; clocks and random always on | ok |
| network grant | addresses or CIDR plus ports, never names (wasi_net). One network key feeds both wasi:sockets and wasi:http (wasi_preview2.erl:387-401). wasi:http resolves a name only with resolve => allow, which also opens DNS lookups to the guest | ok, no host-name policy |
| host imports | #{{Iface, Func} => wasm_component:import_fun(Sig, Fun)}; a missing one is {error, {unresolved_import, _}} at instantiate | ok |
| limits | flat instantiate opts fuel, max_memory_pages, max_depth, max_host_calls; wasm_limits:untrusted/0; timeout only in workers; an inline call stops only when its process is killed; finite fuel forces the interpreter | ok |
| cleanup on kill | pages, sockets, HTTP/1 connections, async tasks freed when the owning process dies; guest code reads only its own message tags, so only exit signals stop it | ok |
| core module cache | keyed by sha256; evicted when no process holds it; 50 loads/s node-wide; hold/1 pins while the calling process lives | ok |
| component worker | none; wasm_instance_worker is core-only (unbounded queue, a queued caller's timeout kills the worker serving another call) | not needed |
| stateful | wasm_actor: send-only, no deadline | later |
| scripts | wasm_script_worker with JS, Python, Lua adapters; JSON in and out; 1.2 to 2 ms overhead per request | later |
| observability | no telemetry, no hooks, no fuel-used readout | missing |
barrel_mcp 4.8.1:
| need | state |
|---|---|
| register and remove tools at runtime with schemas, title, annotations | reg_tool/4, unreg_tool/1: ok |
| one handler for many tools | arity-2 handler gets tool_name in Ctx: ok |
| a process per call, killed on timeout and cancel | timeout kills; notifications/cancelled sends {cancel, ReqId}, kills after 5 s: ok. tasks/cancel and session DELETE never kill |
| structured output, tool errors | {structured, Data, Content}, {tool_error, Content}: ok |
| list_changed | automatic, to every session: ok, not scoped |
| scope | one registry per node; a same-name registration silently overwrites (barrel_mcp_registry.erl:671), so a component could replace an application's native tool; a registry restart wipes every tool: gap |
| ownership | none, tools stay until unreg_tool: gap |
| per-tool data | unknown options dropped, handler is MFA only: gap |
| authorization | visible/4 filters tools/list only; tools/call is not checked: gap |
| input validation | opt-in, schema recompiled per call: not used by us |
Hex: erlang_wasm_tools and wasm_tools both free (hex.pm API 404, 2026-11-29).
13. Plan (nothing merged without the maintainer's review)
One prompt per project, one branch and one pull request per project, one commit per step. The three run in parallel sessions.
- Phase 0 (done): this page; the test components in
test/fixtures/component/(one cargo workspace built byscripts/build-fixtures.shwith plain cargo and the wasm-tools CLI:calculatorandhttp_clientforwasm32-wasip2;data_transform,multi_iface,iface_conflict,custom_hostandlimitsforwasm32-unknown-unknown; erlang_wasm'svectors,counter,hostcallandasyncvalcopied), all smoke-tested against erlang_wasm 0.14.0; and the three prompts:~/Projects/erlang_wasm_component_tools_prompt.md: erlang_wasm, branchcomponent-toolsoff 0.14.0, seven commits (E1 describe, E2 argument checks, E4 HTTP grant and hook, E3 custom sections, E5 memory-limit context, E6 h1 0.13, E7 HTTP peer close).~/Projects/barrel_mcp_dynamic_tools_prompt.md: barrel_mcp, branchdynamic-toolsoff 4.8.1, four commits (B1 owner and exclusive names, B5 tool data, B3 visibility on tools/call, B2 batch registration).~/Projects/erlang_wasm_tools_prompt.md: this repository, branchfirst-release, every step to 0.1.0 (this page and the fixtures, the native API, the MCP adapter, docs and examples), built against the two upstream branches through git dependencies, switched to their Hex releases before 0.1.0.
- Phase 1, in parallel: each prompt in its own session. Before each release, the
docs-maintainability-reviewplan goes to the maintainer (erlang_wasm 0.15.0, barrel_mcp 4.9.0, wasm_tools 0.1.0). - Later, not 0.1: snapshots for components with heavy initialisation; stateful tools
on
wasm_actor; scripts and core modules with an explicit descriptor interface (same schema and codec); async and stream exports; a bounded call queue; a JSON manifest;wasi:config; OCI and remote loaders; a progress host interface; management tools over MCP with a registry ceiling (off by default, behind a scope); the compiled tier.