Tools
host.tools: list and run every installed extension's assistant tools on the user's behalf, without approval prompts, for automation and agent extensions.
host.tools gives an extension the assistant's tools: every installed extension's collection, action and MCP
tools, by the names the assistant uses (tasks_items_create). Calls run exactly as the assistant's do, as the
signed-in person, but nobody is asked for approval: the user granted that when they approved the permission.
It is meant for extensions that act on the user's behalf (automation, agents). Ordinary extensions should keep to
their own data.
interface SpacemixHost {
tools?: ToolsApi; // present with `tools`
}
interface ToolsApi {
list(): Promise<HostTool[]>;
call(name: string, args?: Record<string, unknown>, options?: { via?: string }): Promise<unknown>;
}
interface ToolDefinition {
name: string;
title: string;
description: string;
inputSchema: ObjectSchema;
requiresApproval?: boolean;
}
interface HostTool extends ToolDefinition {
extensionId: string;
readOnly: boolean;
}
Permission: tools. Without it host.tools is undefined.
The same tools, by the same names and with the same validation, are offered to scripts and services over HTTP as
GET /api/v1/tools and POST /api/v1/tools/<name> (see SpaceMIX API). There, an extension's MCP tools can
be called by name but aren't listed, and the API key's tools:read or tools:write scope takes the place of this
permission. The API and the assistant also have the tools of the server's MCP connections
(<connection id>_<tool>); host.tools doesn't list or call those.
host.tools.list
list(): Promise<HostTool[]>;
Every extension tool the assistant could use or load right now (not SpaceMIX's own tools or the server's MCP connections), listed afresh on each call (a just-installed extension's tools are there):
- Collection tools
<ns>_<collection>_<op>and action tools<ns>_<action>of every installed extension, this one included, except a paid one turned off on the server (Turned off until it's paid for). A member's build comes last and loses every name clash with another extension, so a tool of its may be left out. MCP connections aren't part of this list, so a name that is a connection's in a chat reaches the build here. - MCP tools
<ns>_<tool>of every extension with anet:permission. Listing them runs each such extension'smcpresolver, which starts its frame if it isn't running, and lists its servers (cached for 5 minutes). An extension whose servers fail is left out; the failure is logged.
requiresApproval is what the assistant would ask about (ignored here). readOnly is true for collection
list/get, actions declared readOnly, and MCP tools annotated readOnlyHint: true. inputSchema may carry
options hints for forms (see OptionsSource in manifest.md); strip them with modelSchema
before handing a schema to a model. Bridge method: tools.list.
host.tools.call
call(name: string, args?: Record<string, unknown>, options?: { via?: string }): Promise<unknown>;
Runs one tool and resolves with its result. Bridge method: tools.call. Frame timeout: 10 minutes (an action
itself still has the host's 60 seconds, see actions.md).
args(default{}) are validated against the tool's schema like the assistant's calls: undeclared fields are refused,requiredenforced, common slips coerced. MCP tools get them as sent.options.vianames what is acting, such as an automation's name. The called action receivesctx.via = { extension: <your id>, extensionName: <your name>, label: via };extensionandextensionNameare always set by the host, so they can't be forged.- No approval prompt, whatever
requiresApprovalsays.
Errors: an unknown name rejects with There's no tool "<name>". Similar: a, b. (up to five names sharing words
with it) or … Use tools.list() to see them. A tool's own failure (validation, the action throwing, an MCP error)
rejects with the tool's message. A result that is an object whose only field is a string error is also
treated as a failure and rejects with that string.
Example
import { host } from "@spacemix/sdk";
export async function createTask(title: string): Promise<string | undefined> {
const tools = host.tools;
if (!tools) return undefined;
const task = (await tools.call("tasks_items_create", { title }, { via: "Morning routine" })) as { id: string };
return task.id;
}
Stability
Experimental: used by the Automation extension, not yet exercised live across many extensions. The { error }
convention for failures is likely to change.