Skip to content
Back to skills

478 2026 02 02 Tool Name Normalization Be6723f0

ASecurity

Tool calls with leading/trailing whitespace in `tool_name` failed to dispatch (e.g., " glob"), resulting in unknown-tool errors instead of retries. We now normalize tool names before registration and dispatch to avoid whitespace-induced failures.

  • 9 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added June 1, 2026
ai-agents

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 478-2026-02-02-tool-name-normalization_be6723f0 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 478 2026 02 02 Tool Name Normalization Be6723f0?

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

Security grade badge for 478 2026 02 02 Tool Name Normalization Be6723f0
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-478-2026-02-02-tool-name-normalization-be6723f0/badge)](https://www.skillsdirectory.com/skills/tools-only-478-2026-02-02-tool-name-normalization-be6723f0)

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: Normalize Tool Names Before Dispatch
link: tool-name-normalization
type: delta
path: src/tunacode/core/agents/agent_components/orchestrator/tool_dispatcher.py
depth: 0
seams: [M, D]
ontological_relations:
  - relates_to: [[tool-dispatcher]]
  - affects: [[tool-calls]]
  - fixes: [[tool-name-whitespace]]
tags:
  - bug
  - tool-dispatch
  - normalization
  - retry
created_at: 2026-02-02T02:17:43Z
updated_at: 2026-02-02T02:17:43Z
uuid: 2b3b6716-d365-492f-b14f-55e69c9cd4fe
---

# Normalize Tool Names Before Dispatch

## Summary

Tool calls with leading/trailing whitespace in `tool_name` failed to dispatch (e.g., " glob"), resulting in unknown-tool errors instead of retries. We now normalize tool names before registration and dispatch to avoid whitespace-induced failures.

## Context

- File: `src/tunacode/core/agents/agent_components/orchestrator/tool_dispatcher.py`
- Symptom: tool names like " glob" were treated as unknown tools.
- Gap: tests covered suspicious characters but not whitespace-only tool names.

## Root Cause

Tool names were used verbatim from model output, and the suspicious-name guard did not treat whitespace as invalid. This allowed malformed names to reach dispatch without correction.

## Changes

- Added `_normalize_tool_name()` to trim whitespace and fall back to `UNKNOWN_TOOL_NAME` for empty results.
- Normalized tool names during structured and fallback tool-call registration.
- Updated tool-call parts in place only when normalization changes the name.

## Behavioral Impact

- Tool calls with incidental whitespace now dispatch correctly.
- Empty/whitespace-only tool names fail fast as `unknown` and trigger model retry prompts.
- No change to tool execution retry/backoff behavior.

## Related Cards

- [[tool-dispatcher]]
- [[tool-calls]]

Files in this skill

  • README.md1.1 KB
  • skill.md1.8 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.