Create build

Builds and stores one plugin for the caller's org.

POST /v1/tool/plugins/build

Addresshttps://api.hanzo.ai/v1/tool/plugins/build
MethodPOST
Operationpost_tool_plugins_build
AuthAuthorization: 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).

FieldInTypeRequiredDescription
namebodystring—Name is the plugin's name: one lowercase path segment (a-z0-9, _ or -), and the id the runtime loads it by.
providerbodystring—Provider is the connectors provider whose credential the plugin reads at run time.
sourcebodystring—Source is TypeScript to build as-is.
specbodystring—Spec is API documentation — an OpenAPI document, or prose describing the endpoints — that the generator turns into Source.

Response

StatusBodyMeaning
201tool.buildOutcreated
defaultproblem-detailsrefused

201 body — 9 fields.

FieldInTypeAlwaysDescription
bytesbodyinteger (int64)—Bytes is the size of the bundled CommonJS the runtime will execute.
generatedbodyboolean—Generated is whether a model wrote the source from a spec, rather than the caller posting the source itself.
pluginbodytool.AuthoredPlugin—
plugin.createdAtbodyinteger (int64)—CreatedAt is when the plugin was last built, Unix seconds.
plugin.idbodystring—ID is the plugin's id within the org, and the id a delete addresses.
plugin.namebodystring—Name is the plugin's name: one lowercase path segment, the id it runs by.
plugin.orgbodystring—Org is the org that built the plugin — the validated caller's.
plugin.providerbodystring—Provider is the connectors provider whose credential this plugin uses at run time.
plugin.sourcebodystring—Source is the TypeScript as authored (or as generated from a spec).

Failure carries the platform error shape — see Errors.

Examples

hanzo tool plugins build
import { Configuration, ToolApi } from 'hanzoai';

const api = new ToolApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postToolPluginsBuild({ name: "<name>", provider: "<provider>" });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import ToolApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = ToolApi(client).post_tool_plugins_build(name="<name>", provider="<provider>")
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.ToolAPI.PostToolPluginsBuild(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, tool_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = tool_api::post_tool_plugins_build(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.ToolApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new ToolApi(client).postToolPluginsBuild();
curl -X POST https://api.hanzo.ai/v1/tool/plugins/build \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "name": "<name>",
       "provider": "<provider>"
     }'

MCP reaches tool through the tool tool, which names its 17 operations with its own verbs — this one among them, under a name only MCP 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_tools"
         }
       }
     }'

Tool API · All Hanzo APIs · Interactive reference

Was this page useful?