An opencode plugin that automatically trims leading and trailing spaces from tool names before execution.
Sometimes LLMs call tools with accidental spaces in the tool name (e.g., " read" or "bash "). This plugin sanitizes tool names by trimming whitespace before the tool is executed.
Copy trim-tool-name.js to your opencode plugins directory:
- Global:
~/.config/opencode/plugins/ - Project-level:
.opencode/plugins/
The plugin automatically hooks into tool.execute.before events and trims tool names. No configuration needed.
- Uses the
tool.execute.beforehook to intercept all tool calls - Applies
trim()to remove leading/trailing whitespace from tool names - Logs when trimming occurs for debugging purposes
MIT