tool-call-repair

tool-call-repair is a skill for Claude Code from yinqd3/workbuddy-skills. It costs 148 tokens per session (2,929 once invoked), scanned A, original, MIT.

A repair guide for invalid tool-call inputs from language models. It checks the input against a schema, fixes certain recoverable formatting mistakes, and retries validation.

In plain words
What is it for?
Building or debugging the layer that parses and validates tool calls, especially when using open-source language models. It also describes recording repaired and still-invalid inputs.
Why use it?
It helps when an agent produces tool arguments in the wrong shape, such as null optional fields, stringified arrays, or links embedded in values.

Skill for Claude Code

Written for Claude Code: PreToolUse hook event.

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/x/proj/[notes.md](http://notes.md).

Good fit Building or debugging the layer that parses and validates tool calls, especially when using open-source language models. It also describes recording repaired and still-invalid inputs.

Compare 6 skills from other repositories ↓
Install

Getting it into your agent

There is no command for this one: it runs only inside a plugin, and the catalogue could not identify which plugin ships it. The source is linked below.

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for tool-call-repair

README.md
[![agentmods](https://agentmods.dev/badge/skills/yinqd3/workbuddy-skills/tool-call-repair/github.svg)](https://agentmods.dev/skills/yinqd3/workbuddy-skills/tool-call-repair)
Your own site
<a href="https://agentmods.dev/skills/yinqd3/workbuddy-skills/tool-call-repair"><img src="https://agentmods.dev/badge/skills/yinqd3/workbuddy-skills/tool-call-repair/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for tool-call-repair

Your own site · 80×15
<a href="https://agentmods.dev/skills/yinqd3/workbuddy-skills/tool-call-repair"><img src="https://agentmods.dev/badge/skills/yinqd3/workbuddy-skills/tool-call-repair.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 148 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,929 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00148 $0.02929
Opus 5 $0.00074 $0.01465
Sonnet 5 $0.00030 $0.00586
Haiku 4.5 $0.00015 $0.00293

Measured 12d ago against content hash c252a69f385d, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

tool-call-repair scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/repair.py, scripts/repair.ts), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

tool-call-repair/SKILL.md · 338 lines

How it starts

The opening of the file, as written. The whole thing — 338 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Tool Call Repair — 工具调用输入修复管线

概述

当 LLM 输出工具调用参数时,频繁出现四种可穷举的结构性错误。不是模型能力问题,是合约设计问题。此 skill 提供一套 validate-then-repair 管线,在 Zod/JSON Schema 校验失败时自动修复可恢复的输入噪声,并记录修复率遥测数据。

核心理念

严格的 Schema 是一种有代价的选择——它过滤了噪声,也过滤了任何没有背下这个特定 JSON 合约的模型产生的可恢复噪声。

validate-then-repair > preprocess-then-validate:让校验器先报错,Schema 本身就是"哪里会坏"的先验,修复预算只花在校验器实际不同意的精确路径上。


工作流决策树

LLM 输出 tool call 参数
        │
        ▼
  按原样解析 (parse as-is)
        │
   ┌────┴────┐
   ▼         ▼
 成功       失败
   │         │
   ▼         ▼
直接执行   遍历 Zod issue list
           │
           ├─ 形状问题 ──→ 四项修复(按顺序尝试)
           ├─ 链接泄漏 ──→ Markdown 链接解包
           └─ 关系问题 ──→ 扩展语义 + 默认值
                │
                ▼
           再次解析
           ┌───┴───┐
           ▼       ▼
         成功     失败
           │       │
           ▼       ▼
    记录 repaired  记录 invalid
    执行工具       返回模型可读的重试消息

1. 四项通用形状修复

这是覆盖 ~90% 开源模型工具调用失败的模式集合。四项修复共享一个结构:输入 JSON、Zod 报出的 issue 路径、尝试修复 → 返回修复后 JSON 或 null。

修复 1: 剥离 null 值

模型常对可选字段发送 null 而非省略。

# 修复前: {"limit": null, "query": "hello"}
# 修复后: {"query": "hello"}

修复 2: 解析字符串化的 JSON 数组

模型把数组序列化为 JSON 字符串。

# 修复前: {"filePath": "[\"a\",\"b\"]"}
# 修复后: {"filePath": ["a", "b"]}

修复 3: 解包多余的外层对象包装

单参数被包在 {} 里。

# 修复前: {"args": {"query": "hello"}},但 schema 期望 args 是 string
# 修复后: {"args": "hello"}

修复 4: 裸值包装为单元素数组

# 修复前: {"paths": "foo"}
# 修复后: {"paths": ["foo"]}

⚠️ 执行顺序(关键)

修复 2 必须在修复 4 之前运行。否则:

输入: {"paths": "[\"a\",\"b\"]"}
先执行修复4 → {"paths": ["[\"a\",\"b\"]"]}  ← 错误!
先执行修复2 → {"paths": ["a", "b"]}          ← 正确

使用方式

调用 scripts/repair.py

python scripts/repair.py \
  --input '{"filePath":"[\"a\",\"b\"]"}' \
  --schema-path schema.json \
  --tool-name writeFile

输出 JSON:

{
  "repaired": true,
  "output": {"filePath": ["a", "b"]},
  "repairs_applied": ["json_array_parse"],
  "telemetry": "tool_input_repaired:writeFile"
}

Read the full file on GitHub · 338 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 338 lines · 148 tokens per session scan A c252a69f385d

Subscribe to this mod's changes

tool-call-repair is a skill published in the GitHub repository yinqd3/workbuddy-skills (6 stars, last pushed 3mo ago), licensed MIT. It adds 148 tokens to every session and 2,929 once invoked, about $0.0007 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

JustMichael-80/MasterVault · 21 tokens

wiki-lint

Run a deterministic, read-only health check on an Obsidian wiki. Use for lint, vault health check, audit wiki health, find orphans, find dead links, frontmatter audit, provenance audit, or wiki audit. Reports graph, link, frontmatter, provenance-ledger, empty-section, and stale-index findings; it does not reason…

AgriciDaniel/claude-obsidian · 79 tokens

node-zombie-guardian

Use when diagnosing stale or orphaned Node.js processes launched by VCO, auditing ownership/liveness, or safely simulating cleanup without touching external Node workloads.

foryourhealth111-pixel/Vibe-Skills · 37 tokens

architecture-optimization

Guided journey from a working codebase grown slow and tangled to one measurably fast, cleanly bounded, and readable. Orchestrates eight skills phase by phase - working-with-legacy-code, clean-architecture, software-design-philosophy, refactoring-patterns, system-design, ddia-systems, release-it, pragmatic-programmer …

wondelai/skills · 226 tokens

release-it

Build production-ready systems with stability patterns: circuit breakers, bulkheads, timeouts, and retry logic. Use when the user mentions "production outage", "circuit breaker", "deployment pipeline", "chaos engineering", "retry storm", "health checks", "my service keeps crashing", "prevent cascading failures", or…

wondelai/skills · 131 tokens

report-issue-local

File a bug or feature request against this MCP server's own repo. Use for server-specific issues — tool logic, service integrations, config problems, or domain bugs that aren't caused by the framework.

cyanheads/obsidian-mcp-server · 44 tokens