Auto retry & fix LLM tool calls with exponential backoff, format validation, error correction, boost tool call success rate by 90%
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install tool-call-retry或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install tool-call-retry⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/tool-call-retry/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: tool-call-retry slug: tool-call-retry description: Auto retry & fix LLM tool calls with exponential backoff, format validation, error correction, boost tool call success rate by 90% ---
| 参数 | 类型 | 必填 | 默认值 | 说明 | |------|------|------|--------|------| | toolFn | Function | 是 | - | 要执行的工具函数,返回Promise | | args | any | 否 | {} | 调用工具的参数 | | maxRetries | number | 否 | 3 | 最大重试次数,1-10 | | initialDelayMs | number | 否 | 1000 | 初始重试延迟,100-10000ms | | validatorFn | Function | 否 | ()=>true | 结果校验函数,返回true表示结果合法 | | errorHandlerFn | Function | 否 | undefined | 错误处理函数,可返回修复后的参数或中止重试 | | idempotencyKey | string | 否 | undefined | 幂等性键,相同键的调用只会执行一次 |
const fetchWeather = async (params: { city: string }) => {
const res = await fetch(`https://api.weather.com/${params.city}`);
return res.json();
};
const result = await skills.toolCallRetry({
toolFn: fetchWeather,
args: { city: "Beijing" }
});
const result = await skills.toolCallRetry({
toolFn: callLLM,
args: { prompt: "Generate JSON output" },
validatorFn: (res) => typeof res === "object" && res !== null && res.code === 0,
maxRetries: 5
});
const result = await skills.toolCallRetry({
toolFn: callDatabase,
args: { sql: "SELECT * FROM users" },
errorHandlerFn: async (error, attempt) => {
if (error.message.includes("SQL syntax error")) {
// 自动修复SQL语法
const fixedSql = await fixSqlWithLLM(error.message);
return { args: { sql: fixedSql } };
}
if (attempt >= 2) {
// 重试2次失败后中止
return { abort: true };
}
}
});
安装 tool-call-retry 后,可以对 AI 说这些话来触发它
Help me get started with tool-call-retry
Explains what tool-call-retry does, walks through the setup, and runs a quick demo based on your current project
Use tool-call-retry to auto retry & fix LLM tool calls with exponential backoff, format va...
Invokes tool-call-retry with the right parameters and returns the result directly in the conversation
What can I do with tool-call-retry in my developer & devops workflow?
Lists the top use cases for tool-call-retry, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/tool-call-retry/ 目录(个人级,所有项目可用),或 .claude/skills/tool-call-retry/(项目级)。重启 AI 客户端后,用 /tool-call-retry 主动调用,或让 AI 根据上下文自动发现并使用。
tool-call-retry 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
tool-call-retry 可免费安装使用。请查阅仓库了解许可证信息。
Auto retry & fix LLM tool calls with exponential backoff, format validation, error correction, boost tool call success rate by 90%
tool-call-retry 属于「Developer & DevOps」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my developer & devops tasks using tool-call-retry
Identifies repetitive steps in your workflow and sets up tool-call-retry to handle them automatically