Expand description
The embedder-supplied seam for @tools: a program calls one of the
application’s own tools, and the harness that declared it answers.
Every @tools.<tool>(...) call lowers (in codegen) to one host import,
submilli:tools.call(tool, argsJson) -> unknown, exactly as @mcp/<server>
calls lower to submilli:mcp.call. The host fn runs the tools.call
capability check before anything reaches the harness, then awaits the
embedder’s ToolProvider. Normal runtime casts validate declared return
types.
Waiting is not running. The provider may take as long as the harness
needs, for example while a person approves the call. The time spent waiting
is added to StoreData::clock_paused, which an embedder’s execution
timeout subtracts, so a program’s time limit counts its own work only. The
provider bounds the wait itself. Dropping the future returned by
ToolProvider::call is how the engine cancels it.
Enums§
- Tool
Call Error - Why the harness did not return a value. Each maps to a catchable guest error,
except
ToolCallError::Cancelled, which ends the run.
Constants§
- TOOLS_
CAPABILITY - The capability every call is checked against, with the tool in its
toolfield. - TOOLS_
MODULE_ NAME - The internal host module every
@toolscall dispatches through. - TOOLS_
PACKAGE - The source-level name of the virtual package.
Traits§
- Tool
Provider - The embedder-provided answerer for
@toolscalls. The value is a bounded JSON tree (McpResponse::takeadmits it), so guest conversion stays bounded whoever produced it.
Functions§
- install_
tools_ async - Install the async
submilli:tools.callhost fn. Reads(tool, argsJson), runs the capability check, awaitsStoreData::tool_providerwith the clock paused, and builds guest values directly from the returned tree. - tools_
call_ package_ declaration - Codegen-facing definitions for the internal
submilli:tools.callhost fn:call(tool: string, args: string): unknown.