dLazy AIdLazy AI
参考

ToolResult 输出契约

CLI 与 MCP 共享的输出信封。

CLI 与 MCP 共享同一个内部结果。CLI 在 stdout 把它包成 { ok: true, result };MCP 把内部的 result 转发给客户端。

type ToolResult = {
  tool: string;        // cli_name(如 "seedream-4.5")
  modelId: string;     // 服务端模型 ID
  outputs: Output[];   // 始终是数组,不会是标量
  usage?: {
    creditsCost?: number;
    durationMs?: number;
    tokenIn?: number;
    tokenOut?: number;
  };
  task?: {
    generateId: string;
    status: "pending" | "running";
  };
  warning?: string;    // 服务端提示(例如 CLI 版本过旧)
};

type Output = MediaOutput | TextOutput | JsonOutput; // 详见“输出类型”

CLI 信封

成功:

{
  "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 }
  }
}

失败:

{
  "ok": false,
  "code": "insufficient_balance",
  "message": "...",
  "details": {}
}

异步任务

--no-waitoutputs 为空,task 携带任务句柄:

{
  "ok": true,
  "result": {
    "tool": "veo-3.1",
    "modelId": "veo-3-1",
    "outputs": [],
    "task": { "generateId": "gen_abc123", "status": "pending" }
  }
}

dlazy status gen_abc123 --wait --tool veo-3.1 恢复。

On this page