Moonshot Web Search
Run a bundled shell script that calls Moonshot's builtin "$web_search" tool in two rounds and prints the final answer.
This skill must not answer from base-model memory when the script does not run successfully.
Resources
- -
scripts/search.sh: Execute a Moonshot web search and print the model's final answer.
Workflow
- 1. Resolve
SKILL_DIR as the directory containing this SKILL.md. - Require
MOONSHOT_API_KEY before doing anything else. If it is missing, stop immediately and tell the user they need to provide a valid Moonshot API key in the environment. Do not attempt to answer the user's question without the key. - Extract a clean search request from the user's prompt. Preserve concrete constraints such as time range, geography, language, and output format.
- Run the script with an already-resolved absolute path. Do not rely on a temporary env assignment like
SKILL_DIR=... bash "$SKILL_DIR/scripts/search.sh" because many shells expand "$SKILL_DIR" before the temporary assignment takes effect.
CODEBLOCK0
- 5. Return the script output to the user in the requested style. If the user asked for a short answer, compress it after reading the result.
- If the script exits non-zero or prints an error, treat the run as failed. Report the failure clearly and stop. Do not answer the original question from model knowledge, do not guess, and do not invent a cause unless it is present in the actual error output.
Output Expectations
- - Expect plain text output only.
- Do not claim that you personally fetched URLs or inspected source pages unless you actually did so with other tools.
- If the user explicitly needs citations, exact links, or page-level attribution, prefer a browser/search workflow instead of relying only on this skill.
- Tool success is mandatory. No script output means no grounded answer.
- If the runner appears likely to use its own builtin
web_search for a task covered by this skill, do not proceed silently. Tell the user to add a routing rule in OpenClaw's own TOOLS.md that prefers moonshot-web-search for live web search and forbids direct use of builtin web_search.
Troubleshooting
- - If the script reports
请设置 MOONSHOT_API_KEY 环境变量, stop and ask the user to configure the key. Do not answer the original question. - If
curl returns HTTP 429, tell the user the Moonshot account is being rate limited and retry later. - If the first round does not return
tool_calls, surface the error text from the script. - If the second round returns no content, report the script error rather than guessing.
- If a shell error says
/scripts/search.sh: No such file or directory, the runner probably expanded $SKILL_DIR before assigning it. Resolve the absolute script path first, then execute it.
Moonshot 网页搜索
运行一个打包的 Shell 脚本,分两轮调用 Moonshot 内置的 $web_search 工具,并输出最终答案。
当脚本未能成功运行时,此技能不得基于基础模型记忆进行回答。
资源
- - scripts/search.sh:执行 Moonshot 网页搜索并输出模型的最终答案。
工作流程
- 1. 将 SKILLDIR 解析为包含此 SKILL.md 的目录。
- 在执行任何其他操作之前,先要求提供 MOONSHOTAPIKEY。如果缺少该密钥,立即停止并告知用户需要在环境中提供有效的 Moonshot API 密钥。在没有密钥的情况下,不要尝试回答用户的问题。
- 从用户的提示中提取清晰的搜索请求。保留具体约束条件,如时间范围、地理位置、语言和输出格式。
- 使用已解析的绝对路径运行脚本。不要依赖像 SKILLDIR=... bash $SKILLDIR/scripts/search.sh 这样的临时环境变量赋值,因为许多 Shell 会在临时赋值生效之前展开 $SKILLDIR。
bash
SCRIPTPATH=${SKILLDIR}/scripts/search.sh
bash $SCRIPT_PATH
- 5. 按照用户要求的风格将脚本输出返回给用户。如果用户要求简短回答,则在读取结果后进行压缩。
- 如果脚本以非零状态退出或输出错误,则视为运行失败。清晰报告失败原因并停止。不要根据模型知识回答原始问题,不要猜测,也不要编造原因,除非实际错误输出中包含了该原因。
输出预期
- - 仅期望纯文本输出。
- 除非你确实使用其他工具获取了 URL 或查看了源页面,否则不要声称你亲自获取了 URL 或检查了源页面。
- 如果用户明确需要引用来源、精确链接或页面级归属,则优先使用浏览器/搜索工作流程,而不是仅依赖此技能。
- 工具成功运行是强制要求。没有脚本输出意味着没有基于事实的答案。
- 如果运行器似乎要为此技能覆盖的任务使用其内置的 websearch,不要默默进行。告知用户在 OpenClaw 自己的 TOOLS.md 中添加路由规则,优先使用 moonshot-web-search 进行实时网页搜索,并禁止直接使用内置的 websearch。
故障排除
- - 如果脚本报告 请设置 MOONSHOTAPIKEY 环境变量,停止并要求用户配置密钥。不要回答原始问题。
- 如果 curl 返回 HTTP 429,告知用户 Moonshot 账户正在被限流,请稍后重试。
- 如果第一轮未返回 toolcalls,则输出脚本中的错误文本。
- 如果第二轮未返回任何内容,则报告脚本错误,而不是进行猜测。
- 如果 Shell 错误显示 /scripts/search.sh: No such file or directory,则运行器可能在赋值之前展开了 $SKILLDIR。先解析绝对脚本路径,然后再执行。