Skip to content
Back to skills

492 2026 01 28 Decoupled Tools E6c92b6e

ASecurity

Removed direct dependencies on `pydantic-ai` from the `src/tunacode/tools/` directory (specifically `ModelRetry`). Tools now raise a domain-specific `ToolRetryError`, which is intercepted by the tool decorator and translated to `ModelRetry` for the framework. Previously, 8 tool files imported `ModelRetry` from `pydantic_ai.exceptions`. This coupled the business logic of the tools directly to the specific agent framework we are using. - **Added `ToolRetryError`** to `src/tunacode/exceptions.py...

  • 9 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 1, 2026
code-qualitybash

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned June 1, 2026

npx -y skills add tools-only/X-Skills --skill 492-2026-01-28_decoupled-tools_e6c92b6e --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 492 2026 01 28 Decoupled Tools E6c92b6e?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 492 2026 01 28 Decoupled Tools E6c92b6e
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-492-2026-01-28-decoupled-tools-e6c92b6e/badge)](https://www.skillsdirectory.com/skills/tools-only-492-2026-01-28-decoupled-tools-e6c92b6e)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
title: Decoupled Tools from Pydantic-AI
link: decoupled-tools-pydantic-ai
type: delta
path: memory-bank/delta/2026-01-28_decoupled-tools.md
depth: 1
seams: [A] architecture
ontological_relations:
  - relates_to: [[src/tunacode/tools]]
  - affects: [[src/tunacode/exceptions.py]]
  - fixes: [[direct-framework-dependency-in-tools]]
tags:
  - refactor
  - decoupling
  - architecture
created_at: 2026-01-28
---

# Summary
Removed direct dependencies on `pydantic-ai` from the `src/tunacode/tools/` directory (specifically `ModelRetry`). Tools now raise a domain-specific `ToolRetryError`, which is intercepted by the tool decorator and translated to `ModelRetry` for the framework.

# Context
Previously, 8 tool files imported `ModelRetry` from `pydantic_ai.exceptions`. This coupled the business logic of the tools directly to the specific agent framework we are using.

# Changes
- **Added `ToolRetryError`** to `src/tunacode/exceptions.py`.
- **Updated `src/tunacode/tools/decorators.py`** to catch `ToolRetryError` and raise `ModelRetry`. This file now acts as the Adapter.
- **Updated 7 tools** to import and raise `ToolRetryError` instead of `ModelRetry`:
  - `bash.py`
  - `glob.py`
  - `grep.py`
  - `list_dir.py`
  - `update_file.py`
  - `web_fetch.py`
  - `write_file.py`

# Behavioral Impact
No external behavioral change. The LLM still receives the retry signal exactly as before. The change is purely internal structural improvement.

Files in this skill

  • README.md894 B
  • skill.md1.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.