From a29ffd9aa5428f905b9b81884ef0604e95cec9a9 Mon Sep 17 00:00:00 2001 From: kicer Date: Fri, 4 Sep 2026 12:52:10 +0800 Subject: [PATCH] i18n(image-gen): translate AI-facing tool response text to English The tool result content is consumed by AI agents (Claude/Cursor/...). Converted four user-facing strings to clear English: - Missing-token error message - No-URL-in-response error message - Success summary (added expiry note for AI to act on) - Generation-failure error message Code comments and tool description/describes are untouched in this commit. --- mcp/image-gen/src/mcp-server.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mcp/image-gen/src/mcp-server.js b/mcp/image-gen/src/mcp-server.js index 7a4aff4..b05484f 100644 --- a/mcp/image-gen/src/mcp-server.js +++ b/mcp/image-gen/src/mcp-server.js @@ -137,7 +137,7 @@ function buildServer() { { type: "text", text: - "缺少鉴权 token。", + "Missing authentication token. The caller must provide a Zhipu API token via an HTTP request header (e.g. `X-Image-Gen-Token: ` or `Authorization: Bearer `). The server is configured to read the token from the request header on every call, not from the tool arguments, so the token cannot be supplied here.", }, ], }; @@ -163,19 +163,19 @@ function buildServer() { content: [ { type: "text", - text: `调用成功但未返回图片 URL:${JSON.stringify(data)}`, + text: `The Zhipu API call succeeded but returned no image URL. Raw response: ${JSON.stringify(data)}`, }, ], }; } const summary = urls - .map((u, i) => `图片 ${i + 1}: ${u}`) + .map((u, i) => `Image ${i + 1}: ${u}`) .join("\n"); return { content: [ { type: "text", - text: `模型: ${model}\n提示词: ${args.prompt}\n${summary}`, + text: `Model: ${model}\nPrompt: ${args.prompt}\n${summary}\n\nThe image is hosted on a signed Zhipu URL and will expire (typically within 24 hours, see the URL's Expires parameter). If the user needs to keep it, download or copy the image right away.`, }, ...urls.map((u) => ({ type: "text", text: u })), ], @@ -186,8 +186,8 @@ function buildServer() { content: [ { type: "text", - text: `生成图片失败: ${e.message}${ - e.detail ? `\n详情: ${JSON.stringify(e.detail)}` : "" + text: `Failed to generate image: ${e.message}${ + e.detail ? `\nDetails: ${JSON.stringify(e.detail)}` : "" }`, }, ],