Builds and stores one plugin for the caller's org.
Builds and stores one plugin for the caller's org. The 201 carries the bundle's size, whether a model wrote the source, and the plugin as stored.
POST /v1/tools/plugins/build
| Address | https://api.hanzo.ai/v1/tools/plugins/build |
| Method | POST |
| Operation | post_tools_plugins_build |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Builds and stores one plugin for the caller's org. The 201 carries the bundle's size, whether a model wrote the source, and the plugin as stored.
Post source to build TypeScript as-is, or spec — an OpenAPI document or
plain prose describing the endpoints — to have one generated; the generated
source comes back in the answer, so a caller reads what will run before it
runs. Exactly one of the two, and name must be one lowercase path segment;
both or neither is 400.
COMPILING IS THE GATE. The source goes through the same pipeline the committed
connectors do — esbuild to one CommonJS program, then compiled in the goja
runtime that will actually execute it — and anything that fails is rejected and
NEVER stored. So a plugin in the store is one this deployment has already
loaded once, not one a model claimed was fine. A failed build answers 422
carrying the diagnostics a caller needs to fix it: the bundler's error
(detail), the source that failed, and whether the model wrote it.
CREDENTIALS ARE NOT PART OF A PLUGIN. A plugin names the connectors provider
it needs and reads that credential from ctx.auth at run time, under KMS
custody. Source that carries something key-shaped is REFUSED rather than
silently persisted — a scrubbed key looks like it worked.
Request
4 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
name | body | string | — | Name is the plugin's name: one lowercase path segment (a-z0-9, _ or -), and the id the runtime loads it by. |
provider | body | string | — | Provider is the connectors provider whose credential the plugin reads at run time. |
source | body | string | — | Source is TypeScript to build as-is. |
spec | body | string | — | Spec is API documentation — an OpenAPI document, or prose describing the endpoints — that the generator turns into Source. |
Response
| Status | Body | Meaning |
|---|---|---|
201 | buildOut | created |
201 body — 9 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
bytes | body | integer | — | Bytes is the size of the bundled CommonJS the runtime will execute. |
generated | body | boolean | — | Generated is whether a model wrote the source from a spec, rather than the caller posting the source itself. |
plugin | body | AuthoredPlugin | — | |
plugin.createdAt | body | integer | — | CreatedAt is when the plugin was last built, Unix seconds. |
plugin.id | body | string | — | ID is the plugin's id within the org, and the id a delete addresses. |
plugin.name | body | string | — | Name is the plugin's name: one lowercase path segment, the id it runs by. |
plugin.org | body | string | — | Org is the org that built the plugin — the validated caller's. |
plugin.provider | body | string | — | Provider is the connectors provider whose credential this plugin uses at run time. Absent for a plugin that needs none. |
plugin.source | body | string | — | Source is the TypeScript as authored (or as generated from a spec). |
Failure carries the platform error shape — see Errors.
Examples
hanzo has no subcommand for this operation — the CLI serves only what cloud's live route table confirms. Use HTTP or an SDK.
import { Configuration, ToolsApi } from 'hanzoai';
const api = new ToolsApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postToolsPluginsBuild({ name: "<name>", provider: "<provider>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import ToolsApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = ToolsApi(client).post_tools_plugins_build(name="<name>", provider="<provider>")cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.ToolsAPI.PostToolsPluginsBuild(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, tools_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = tools_api::post_tools_plugins_build(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.ToolsApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new ToolsApi(client).postToolsPluginsBuild();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl -X POST https://api.hanzo.ai/v1/tools/plugins/build \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "<name>",
"provider": "<provider>"
}'The door reaches tools through the tools tool, which names its 19 operations with its own verbs — this one among them, under a name only the door declares. describe explains any of them:
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "describe",
"arguments": {
"op": "list_mcp_servers"
}
}
}'How is this guide?