Skip to content

tool_translator

diapason.skills.tool_translator

ToolTranslator — translate external tool names to Diapason equivalents.

External skill libraries (Hermes Agent, OpenClaw) reference tools by Claude Code's standard tool names (Bash, Read, Write, etc.). Diapason uses different names (shell_exec, file_read, file_write). This module translates those references in skill markdown bodies and allowed-tools fields.

The translation table is small (~10 entries) covering Claude Code's standard tools and grows as we encounter new vendor tools.

ToolTranslator

Rewrite tool references in markdown bodies and allowed-tools fields.

Uses a word-boundary regex so partial matches like 'Reader' or 'Reading' are not rewritten.

translate_allowed_tools(allowed)

Translate the space-delimited allowed-tools field.

Tokens may have parenthesized arguments like Bash(git:*). Only the prefix before the first ( is translated.

translate_markdown(body)

Translate tool references in a markdown body.

Returns

tuple[str, list[str]] (rewritten body, list of untranslated tool names found)