dsh-arg-guard

Validates every tool call against that tool's own parameters schema before it runs, and denies with the exact path and type. The host renders a tool's parameters into the prompt but never checks a call against them, so a wrong-typed value reaches the tool body: a number lands in path.join and the caller gets a raw TypeError instead of an answer. This plugin hooks tools/pre-execute, resolves the definition, and returns a deny whose reason reads "demo_tool.dir: expected string, got number (123)". Covers primitive types and unions, required, enum/const, nested properties, array items, additionalProperties:false, and oneOf/anyOf/allOf. Fails open on purpose: an internal error, an unknown tool, or a schema construct it cannot read allows the call. mode deny or warn, plus a skip list. Two read-only tools, arg_guard_status and arg_guard_check.

Overview

Validates every tool call against that tool's own parameters schema before it runs, and denies with the exact path and type. The host renders a tool's parameters into the prompt but never checks a call against them, so a wrong-typed value reaches the tool body: a number lands in path.join and the caller gets a raw TypeError instead of an answer. This plugin hooks tools/pre-execute, resolves the definition, and returns a deny whose reason reads "demo_tool.dir: expected string, got number (123)". Covers primitive types and unions, required, enum/const, nested properties, array items, additionalProperties:false, and oneOf/anyOf/allOf. Fails open on purpose: an internal error, an unknown tool, or a schema construct it cannot read allows the call. mode deny or warn, plus a skip list. Two read-only tools, arg_guard_status and arg_guard_check.

Installation

Install from GitHub

dsh plugin --profile web add github:bushizhanghan/dsh-arg-guard

Installing from GitHub runs the project's build script, which pnpm blocks until you allowlist it — run the command once and pnpm prints the exact key to add under `allowBuilds` in ~/.dsh/profiles/web/pnpm-workspace.yaml.

Version compatibility

Compatibility is unconfirmed. Check the project documentation for supported versions.