[Bug] Workflow tool delivers JSON args as string instead of parsed object
Bug Description
Title: Workflow tool — object/array passed as args arrives in the script as a JSON string, contradicting the documented "verbatim" contract
Summary: When the Workflow tool is invoked with args set to a JSON object or array, the workflow script's args global is a JSON-encoded string, not the parsed value. The tool description says args is delivered "verbatim" and that passing "arrays/objects as actual JSON values" lets the script call args.map/args.filter — but those fail because args is a string, so args.foo is undefined and args.map throws.
Minimal repro (zero agents): Workflow call with args: {"probe":"hello","n":42} and script:
export const meta = { name: 'args-diag', description: 'x' }
return { argsType: typeof args, probe: (args && typeof args === 'object') ? args.probe : '(not object)' }
- Observed: {"argsType":"string","probe":"(not object)"} — args is the literal string "{\"probe\":\"hello\",\"n\":42}".
- Expected (per docs): argsType: "object", args.probe === "hello".
Impact: Scripts written to the documented pattern silently get undefined. In my case, a fan-out workflow interpolated undefined file paths into subagent prompts (${args.contextPath} → "undefined"), degrading context-passing — the agents recovered, but it's a silent footgun.
Workaround: const a = typeof args === 'string' ? JSON.parse(args) : args;
Suggested fix: Either deliver args already-parsed (match the docs), or correct the tool description to state args arrives as a JSON string requiring JSON.parse.
Env: Claude Code · model claude-opus-4-8[1m].
Environment Info
- Platform: darwin
- Terminal: WezTerm
- Version: 2.1.195
- Feedback ID: 3a21a48d-ae1c-44cd-990d-33f4b6e41cff
Errors
[]This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗