Reference
ToolResult Contract
The unified envelope shared by CLI and MCP.
The CLI and MCP surfaces share the same inner result. The CLI wraps it as { ok: true, result } on stdout; MCP forwards the inner result to the client.
type ToolResult = {
tool: string; // cli_name (e.g. "seedream-4.5")
modelId: string; // server-side model id
outputs: Output[]; // always an array, never a scalar
usage?: {
creditsCost?: number;
durationMs?: number;
tokenIn?: number;
tokenOut?: number;
};
task?: {
generateId: string;
status: "pending" | "running";
};
warning?: string; // server-side advisory (e.g. CLI version drift)
};
type Output = MediaOutput | TextOutput | JsonOutput; // see "Output Types"CLI Envelope
Success:
{
"ok": true,
"result": {
"tool": "gpt-image-2",
"modelId": "gpt-image-2",
"outputs": [
{
"type": "image",
"id": "o_8a1f3b7d",
"url": "https://cdn.dlazy.com/...png",
"mimeType": "image/png"
}
],
"usage": { "creditsCost": 5, "durationMs": 6420 }
}
}Failure:
{
"ok": false,
"code": "insufficient_balance",
"message": "...",
"details": {}
}Async Tasks
With --no-wait, outputs is empty and task carries the handle:
{
"ok": true,
"result": {
"tool": "veo-3.1",
"modelId": "veo-3-1",
"outputs": [],
"task": { "generateId": "gen_abc123", "status": "pending" }
}
}Resume with dlazy status gen_abc123 --wait --tool veo-3.1.