{
  "tools": [
    {
      "tool_id": "image_stitcher",
      "name": "图片拼接工具",
      "category": "cv",
      "description": "将多张图片按指定方向（水平/垂直/网格）拼接成一张大图。支持间距设置、背景色填充和统一缩放模式。输入输出均为 Base64 编码的 PNG 图片。",
      "input_schema": {
        "properties": {
          "background_color": {
            "default": "#FFFFFF",
            "description": "间距填充背景色，十六进制颜色值",
            "type": "string"
          },
          "columns": {
            "default": 2,
            "description": "grid 模式下每行的列数",
            "minimum": 1,
            "type": "integer"
          },
          "direction": {
            "default": "horizontal",
            "description": "拼接方向：horizontal=水平，vertical=垂直，grid=网格",
            "enum": [
              "horizontal",
              "vertical",
              "grid"
            ],
            "type": "string"
          },
          "images": {
            "description": "Base64 编码的图片列表，至少 2 张",
            "items": {
              "type": "string"
            },
            "minItems": 2,
            "type": "array"
          },
          "resize_mode": {
            "default": "none",
            "description": "缩放模式：none=不缩放，fit_width=统一宽度，fit_height=统一高度",
            "enum": [
              "none",
              "fit_width",
              "fit_height"
            ],
            "type": "string"
          },
          "spacing": {
            "default": 0,
            "description": "图片间距（像素）",
            "minimum": 0,
            "type": "integer"
          }
        },
        "reason": "图片拼接工具输入参数定义",
        "required": [
          "images"
        ],
        "type": "object"
      },
      "output_schema": {
        "properties": {
          "height": {
            "description": "结果图高度（像素）",
            "type": "integer"
          },
          "image": {
            "description": "拼接结果，Base64 编码的 PNG 图片",
            "type": "string"
          },
          "width": {
            "description": "结果图宽度（像素）",
            "type": "integer"
          }
        },
        "reason": "图片拼接工具输出结果定义",
        "required": [
          "image",
          "width",
          "height"
        ],
        "type": "object"
      },
      "stream_support": false,
      "status": "active",
      "backend_runtime": "local",
      "group_ids": [],
      "tool_slug_ids": []
    },
    {
      "tool_id": "liblibai_controlnet",
      "name": "LibLib ControlNet 图生图",
      "category": "cv",
      "description": "基于 LibLib AI 开放 API 的 ControlNet Canny 图生图工具，支持通过边缘检测控制图像生成",
      "input_schema": {
        "type": "object",
        "properties": {
          "image": {
            "type": "string",
            "description": "图片来源，支持 Base64 编码的图片数据或 HTTP 图片 URL"
          },
          "prompt": {
            "type": "string",
            "description": "正向提示词"
          },
          "negative_prompt": {
            "type": "string",
            "description": "反向提示词",
            "default": "lowres, bad anatomy, text, error"
          },
          "width": {
            "type": "integer",
            "description": "输出宽度",
            "default": 512
          },
          "height": {
            "type": "integer",
            "description": "输出高度",
            "default": 512
          },
          "steps": {
            "type": "integer",
            "description": "采样步数",
            "default": 20
          },
          "cfg_scale": {
            "type": "number",
            "description": "CFG Scale",
            "default": 7
          },
          "img_count": {
            "type": "integer",
            "description": "生成图片数量",
            "default": 1
          },
          "control_weight": {
            "type": "number",
            "description": "ControlNet 权重",
            "default": 1
          },
          "preprocessor": {
            "type": "integer",
            "description": "预处理器枚举",
            "default": 1
          },
          "canny_low": {
            "type": "integer",
            "description": "Canny 低阈值",
            "default": 100
          },
          "canny_high": {
            "type": "integer",
            "description": "Canny 高阈值",
            "default": 200
          }
        },
        "required": [
          "image",
          "prompt"
        ]
      },
      "output_schema": {
        "type": "object",
        "properties": {
          "images": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "生成的图片 URL 列表"
          },
          "task_id": {
            "type": "string",
            "description": "任务 ID"
          },
          "status": {
            "type": "string",
            "description": "任务状态（success/failed/timeout）"
          }
        }
      },
      "stream_support": false,
      "status": "active",
      "backend_runtime": "local",
      "group_ids": [],
      "tool_slug_ids": []
    },
    {
      "tool_id": "launch_comfy_env",
      "name": "Launch ComfyUI Environment",
      "category": "ai",
      "description": "启动 RunComfy 云端机器并等待就绪。返回 server_id 用于后续 ComfyUI workflow 执行。需要环境变量 RUNCOMFY_USER_ID 和 API_TOKEN。",
      "input_schema": {
        "type": "object",
        "properties": {
          "version_id": {
            "type": "string",
            "description": "RunComfy workflow version ID",
            "default": "90f77137-ba75-400d-870f-204c614ae8a3"
          },
          "server_type": {
            "type": "string",
            "enum": [
              "medium",
              "large",
              "extra-large",
              "2x-large",
              "2xl-turbo"
            ],
            "description": "机器规格",
            "default": "medium"
          },
          "duration": {
            "type": "integer",
            "description": "预估运行时长（秒）",
            "default": 3600
          }
        }
      },
      "output_schema": {
        "type": "object",
        "properties": {
          "server_id": {
            "type": "string",
            "description": "机器唯一标识，用于后续操作"
          },
          "comfy_url": {
            "type": "string",
            "description": "ComfyUI 访问地址"
          },
          "status": {
            "type": "string",
            "description": "机器状态"
          },
          "usage_instruction": {
            "type": "string",
            "description": "使用说明"
          }
        },
        "required": [
          "server_id",
          "comfy_url",
          "status",
          "usage_instruction"
        ]
      },
      "stream_support": false,
      "status": "active",
      "backend_runtime": "local",
      "group_ids": [
        "runcomfy_lifecycle"
      ],
      "tool_slug_ids": [
        "comfyui"
      ]
    },
    {
      "tool_id": "runcomfy_workflow_executor",
      "name": "RunComfy Workflow Executor",
      "category": "image_generation",
      "description": "在已就绪的 RunComfy 机器上提交 ComfyUI 工作流，上传输入文件，监听执行状态，下载结果图片（不启动/关闭机器）",
      "input_schema": {
        "type": "object",
        "required": [
          "server_id",
          "workflow_api"
        ],
        "properties": {
          "server_id": {
            "type": "string",
            "description": "已启动的 RunComfy 机器 ID"
          },
          "workflow_api": {
            "type": "object",
            "description": "ComfyUI workflow_api.json 内容（字典格式）"
          },
          "input_files": {
            "type": "array",
            "description": "可选的输入文件列表",
            "items": {
              "type": "object",
              "required": [
                "filename",
                "type",
                "base64_data"
              ],
              "properties": {
                "filename": {
                  "type": "string",
                  "description": "文件名"
                },
                "type": {
                  "type": "string",
                  "description": "文件类型：images/loras/checkpoints/vae/controlnet"
                },
                "base64_data": {
                  "type": "string",
                  "description": "文件的 Base64 编码数据"
                }
              }
            }
          }
        }
      },
      "output_schema": {
        "type": "object",
        "properties": {
          "prompt_id": {
            "type": "string",
            "description": "任务 ID"
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "结果图片的 Base64 数据列表"
          },
          "status": {
            "type": "string",
            "description": "执行状态"
          },
          "server_id": {
            "type": "string",
            "description": "机器 ID"
          }
        }
      },
      "stream_support": false,
      "status": "active",
      "backend_runtime": "local",
      "group_ids": [
        "runcomfy_lifecycle"
      ],
      "tool_slug_ids": [
        "comfyui"
      ]
    },
    {
      "tool_id": "runcomfy_stop_env",
      "name": "RunComfy Stop Service",
      "category": "cloud",
      "description": "Stop and delete RunComfy server instances to release resources. Works with launch_comfy_env for complete lifecycle management.",
      "input_schema": {
        "type": "object",
        "properties": {
          "server_id": {
            "type": "string",
            "description": "The server ID to stop"
          }
        },
        "required": [
          "server_id"
        ]
      },
      "output_schema": {
        "type": "object",
        "properties": {
          "server_id": {
            "type": "string",
            "description": "The stopped server ID"
          },
          "status": {
            "type": "string",
            "description": "Deleted, NotFound, or Error"
          },
          "message": {
            "type": "string",
            "description": "Detailed result message"
          }
        }
      },
      "stream_support": false,
      "status": "active",
      "backend_runtime": "local",
      "group_ids": [
        "runcomfy_lifecycle"
      ],
      "tool_slug_ids": [
        "comfyui"
      ]
    },
    {
      "tool_id": "ji_meng_add_task",
      "name": "即梦-创建任务",
      "tool_slug_ids": [],
      "category": "cv",
      "description": "提交异步任务到上游（本地服务转发 JI_MENG_API_BASE，POST /add_task）。需配置 tools/local/ji_meng/.env。",
      "input_schema": {
        "type": "object",
        "properties": {
          "task_type": {
            "type": "string",
            "enum": [
              "image",
              "video"
            ],
            "description": "任务类型：图生/文生图或视频"
          },
          "prompt": {
            "type": "string",
            "description": "任务描述 / 提示词"
          },
          "image_url": {
            "type": "string",
            "description": "可选，图生类任务时的参考图 URL"
          }
        },
        "required": [
          "task_type",
          "prompt"
        ]
      },
      "output_schema": {
        "type": "object",
        "properties": {
          "task_id": {
            "type": "string",
            "description": "任务 ID，用于 ji_meng_query_task"
          },
          "status": {
            "type": "string"
          }
        }
      },
      "stream_support": false,
      "status": "active",
      "backend_runtime": "local",
      "group_ids": [
        "ji_meng_task_lifecycle"
      ]
    },
    {
      "tool_id": "ji_meng_query_task",
      "name": "即梦-查询任务",
      "tool_slug_ids": [],
      "category": "cv",
      "description": "按 task_id 查询任务状态与结果（本地服务转发上游，POST /query_task）。",
      "input_schema": {
        "type": "object",
        "properties": {
          "task_id": {
            "type": "string",
            "description": "ji_meng_add_task 返回的任务 ID"
          }
        },
        "required": [
          "task_id"
        ]
      },
      "output_schema": {
        "type": "object",
        "properties": {
          "task_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "message": {
            "type": "string"
          },
          "images": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "stream_support": false,
      "status": "active",
      "backend_runtime": "local",
      "group_ids": [
        "ji_meng_task_lifecycle"
      ]
    },
    {
      "tool_id": "nano_banana",
      "name": "Nano Banana（Gemini 图模）",
      "tool_slug_ids": [],
      "category": "cv",
      "description": "通过 Google Gemini 原生图模 REST generateContent 文生图/图生图。需 GEMINI_API_KEY；可选 gemini-2.5-flash-image、gemini-3.1-flash-image-preview 等。详见 https://ai.google.dev/gemini-api/docs/image-generation?hl=zh-cn#rest",
      "input_schema": {
        "type": "object",
        "properties": {
          "prompt": {
            "type": "string",
            "description": "提示词（文生图或与参考图配合做编辑）"
          },
          "model": {
            "type": "string",
            "description": "模型 ID；省略则使用环境变量 GEMINI_IMAGE_MODEL，默认 gemini-2.5-flash-image。示例：gemini-3.1-flash-image-preview"
          },
          "aspect_ratio": {
            "type": "string",
            "description": "输出宽高比，如 1:1、16:9（对应 generationConfig.imageConfig.aspectRatio）"
          },
          "image_size": {
            "type": "string",
            "description": "Gemini 3.x 输出规格：512、1K、2K、4K（须大写 K，见官方文档）"
          },
          "response_modalities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "如 [\"TEXT\",\"IMAGE\"] 或 [\"IMAGE\"]；省略则由 API 默认"
          },
          "images": {
            "type": "array",
            "description": "可选参考图，每项为 {mime_type, data}，data 为 Base64 或 data URL",
            "items": {
              "type": "object",
              "properties": {
                "mime_type": {
                  "type": "string"
                },
                "data": {
                  "type": "string"
                }
              },
              "required": [
                "data"
              ]
            }
          }
        },
        "required": [
          "prompt"
        ]
      },
      "output_schema": {
        "type": "object",
        "properties": {
          "images": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "data:mime;base64,... 列表"
          },
          "model": {
            "type": "string",
            "description": "实际调用的模型 ID"
          },
          "text": {
            "type": "string",
            "description": "若返回文本部分则在此汇总"
          }
        }
      },
      "stream_support": false,
      "status": "active",
      "backend_runtime": "local",
      "group_ids": []
    },
    {
      "tool_id": "flux_submit",
      "name": "FLUX-提交生图任务",
      "tool_slug_ids": [],
      "category": "cv",
      "description": "向 BFL 提交异步生图任务（POST /v1/{model}）。需 BFL_API_KEY；model 为端点名如 flux-2-pro-preview。返回 id、polling_url 供 flux_query 轮询。文档 https://docs.bfl.ai/quick_start/generating_images",
      "input_schema": {
        "type": "object",
        "properties": {
          "model": {
            "type": "string",
            "description": "端点路径段，如 flux-2-pro-preview、flux-2-max、flux-dev、flux-kontext-pro 等"
          },
          "prompt": {
            "type": "string",
            "description": "提示词"
          },
          "width": {
            "type": "integer",
            "description": "输出宽度（像素），可选"
          },
          "height": {
            "type": "integer",
            "description": "输出高度（像素），可选"
          },
          "parameters": {
            "type": "object",
            "description": "合并进 BFL 请求体的额外字段（模型专有参数）"
          }
        },
        "required": [
          "model",
          "prompt"
        ]
      },
      "output_schema": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "请求 ID，flux_query 的 request_id"
          },
          "polling_url": {
            "type": "string",
            "description": "轮询地址，须原样传给 flux_query（全球端点必须用返回的 URL）"
          }
        }
      },
      "stream_support": false,
      "status": "active",
      "backend_runtime": "local",
      "group_ids": [
        "flux_bfl_lifecycle"
      ]
    },
    {
      "tool_id": "flux_query",
      "name": "FLUX-查询任务结果",
      "tool_slug_ids": [],
      "category": "cv",
      "description": "按 flux_submit 返回的 polling_url 与 id 轮询状态；Ready 时 result.sample 为签名图 URL（约 10 分钟有效）。",
      "input_schema": {
        "type": "object",
        "properties": {
          "polling_url": {
            "type": "string",
            "description": "提交响应中的 polling_url"
          },
          "request_id": {
            "type": "string",
            "description": "提交响应中的 id"
          }
        },
        "required": [
          "polling_url",
          "request_id"
        ]
      },
      "output_schema": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "description": "如 Ready、Pending、Error、Failed 等"
          },
          "result": {
            "type": "object",
            "description": "成功时常含 sample（图片签名 URL）"
          }
        }
      },
      "stream_support": false,
      "status": "active",
      "backend_runtime": "local",
      "group_ids": [
        "flux_bfl_lifecycle"
      ]
    },
    {
      "tool_id": "midjourney_submit_job",
      "name": "Midjourney-提交生图任务",
      "tool_slug_ids": [],
      "category": "cv",
      "description": "提交 Midjourney 生图任务（转发至 MIDJOURNEY_API_BASE/submit_job）。需配置 tools/local/midjourney/.env。mode 为 relaxed 或 fast。",
      "input_schema": {
        "type": "object",
        "properties": {
          "cookie": {
            "type": "string",
            "description": "Midjourney 会话 cookie"
          },
          "prompt": {
            "type": "string",
            "description": "提示词"
          },
          "user_id": {
            "type": "string",
            "description": "用户 ID"
          },
          "mode": {
            "type": "string",
            "enum": [
              "relaxed",
              "fast"
            ],
            "description": "队列模式：relaxed 或 fast"
          }
        },
        "required": [
          "cookie",
          "prompt",
          "user_id",
          "mode"
        ]
      },
      "output_schema": {
        "type": "object",
        "description": "上游返回 JSON，通常含 job_id 或 id",
        "properties": {}
      },
      "stream_support": false,
      "status": "active",
      "backend_runtime": "local",
      "group_ids": [
        "midjourney_lifecycle"
      ]
    },
    {
      "tool_id": "midjourney_query_job_status",
      "name": "Midjourney-查询任务状态",
      "tool_slug_ids": [],
      "category": "cv",
      "description": "查询指定任务状态（转发 MIDJOURNEY_API_BASE/query_job_status）。",
      "input_schema": {
        "type": "object",
        "properties": {
          "cookie": {
            "type": "string",
            "description": "Midjourney 会话 cookie"
          },
          "job_id": {
            "type": "string",
            "description": "submit_job 返回的任务 ID"
          }
        },
        "required": [
          "cookie",
          "job_id"
        ]
      },
      "output_schema": {
        "type": "object",
        "description": "上游状态 JSON，如 status / job_status 等",
        "properties": {}
      },
      "stream_support": false,
      "status": "active",
      "backend_runtime": "local",
      "group_ids": [
        "midjourney_lifecycle"
      ]
    },
    {
      "tool_id": "midjourney_get_image_urls",
      "name": "Midjourney-获取结果图链接",
      "tool_slug_ids": [],
      "category": "cv",
      "description": "根据 job_id 获取 4 张图 URL（转发 MIDJOURNEY_API_BASE/get_image_urls）。",
      "input_schema": {
        "type": "object",
        "properties": {
          "job_id": {
            "type": "string",
            "description": "任务 ID"
          }
        },
        "required": [
          "job_id"
        ]
      },
      "output_schema": {
        "type": "object",
        "description": "上游返回 JSON 或 URL 数组，常见字段 image_urls / urls",
        "properties": {
          "image_urls": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "四张图片链接（字段名以实际服务为准）"
          }
        }
      },
      "stream_support": false,
      "status": "active",
      "backend_runtime": "local",
      "group_ids": [
        "midjourney_lifecycle"
      ]
    }
  ],
  "version": "2.0"
}