Create declare
Republishes what a registered runner can do, and answers with what this side understands, so the two learn about each other from one exchange.
POST /v1/runner/declare
| Address | https://api.hanzo.ai/v1/runner/declare |
| Method | POST |
| Operation | post_runner_declare |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Republishes what a registered runner can do, and answers with what this side understands, so the two learn about each other from one exchange.
Request
5 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
x-runner-uuid | header | string | — | |
x-runner-token | header | string | — | |
capabilities | body | string[] | — | Capabilities are the optional protocol behaviours this runner understands, e.g. |
labels | body | string[] | — | Labels replace what the forge holds, so a relabelled runner follows its configuration without re-registering. |
version | body | string | — | Version is the runner build now running. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | runner.DeclareOut | ok |
default | problem-details | refused |
200 body — 9 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
capabilities | body | string[] | — | Capabilities are what THIS FORGE understands, so a runner learns what the other side supports from the reply body rather than from a header. |
runner | body | runner.Identity | — | |
runner.ephemeral | body | boolean | — | Ephemeral means the runner takes ONE job and exits, so the forge must not expect it back. |
runner.id | body | integer (int64) | — | ID is the forge's own row id for this runner. |
runner.labels | body | string[] | — | Labels are what a workflow's runs-on: selects this runner by. |
runner.name | body | string | — | Name is what a person calls this runner in the forge's UI. |
runner.token | body | string | — | Token is the secret that authenticates that handle. |
runner.uuid | body | string | — | UUID is the handle the runner presents on every later op. |
runner.version | body | string | — | Version is the runner build the forge last heard from. |
Failure carries the platform error shape — see Errors.
Examples
hanzo runner declareimport { Configuration, GitApi } from 'hanzoai';
const api = new GitApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postRunnerDeclare({ capabilities: ["<capabilities>"], labels: ["<labels>"] });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import GitApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = GitApi(client).post_runner_declare(capabilities=["<capabilities>"], labels=["<labels>"])cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.GitAPI.PostRunnerDeclare(context.Background()).Execute()
if err != nil {
return err
}use hanzo_client::apis::{configuration::Configuration, git_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = git_api::post_runner_declare(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.GitApi;
ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));
var result = new GitApi(client).postRunnerDeclare();The method above is the one at the current release of the document. [email protected] (npm) was 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/runner/declare \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"capabilities": [
"<capabilities>"
],
"labels": [
"<labels>"
]
}'MCP reaches git through the git tool, which names its 56 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": "get_git"
}
}
}'How is this guide?