Workflow tool: args reaches the script as a JSON string even when the caller passes a real JSON object
Environment: Claude Code (macOS, darwin 25.x), Workflow tool with args input.
Expected: Per the Workflow tool docs — "Pass arrays/objects as actual JSON values in the tool call, NOT as a JSON-encoded string" — a call with args: {"x": 1} should expose args to the script as an object, so args.x === 1.
Actual: Inside the script, typeof args === "string". Property access silently yields undefined (args.x → undefined, no error), so scripts that interpolate ${args.x} into agent prompts fan out with the literal text "undefined" — an expensive silent failure.
Repro (minimal, 0 agents):
Workflow({
script: `export const meta = { name: 'args-type-probe', description: 'probe args type' }
return { type: typeof args, value: args }`,
args: { x: 1 }
})
Result: { "type": "string", "value": "{\"x\":1}" } — reproduced consistently (our runs wf_6b0e2366-366, first hit in a production workflow wf_d9898590-c87).
Workaround: open every script withconst A = typeof args === 'string' ? JSON.parse(args) : (args ?? {}).
Suggested fix: parse args once at the runtime boundary before injecting it as the script global (or update the tool description to say it arrives as a string).
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗