Skip to content

Conversation

@ammar-agent
Copy link
Collaborator

Summary

Add shell-friendly flattened tool hook env vars (MUX_TOOL_INPUT_<…> / MUX_TOOL_RESULT_<…>) so hooks can access common fields without JSON parsing.

Background

Hooks are frequently authored in bash, and parsing MUX_TOOL_INPUT with jq/Python is noisy. We still keep the raw JSON env vars + *_PATH files for full fidelity and backwards compatibility.

Implementation

  • Introduce shared flattening + naming helper (src/common/utils/tools/toolHookEnv.ts) used by both runtime and docs generation.
  • Populate flattened env vars for legacy tool_hook and new tool_pre/tool_post paths.
  • Avoid env bloat by capping emitted vars/array length and omitting oversized values (rely on *_PATH).
  • Auto-generate per-tool env var appendix in docs/hooks/tools.mdx from TOOL_DEFINITIONS.
  • Update examples to use flattened vars instead of jq.

Validation

  • bun test src/common/utils/tools/toolHookEnv.test.ts
  • bun test src/node/services/hooks.test.ts
  • bun scripts/gen_docs.ts
  • make static-check

Risks

  • Environment size/SSH command length: mitigated via conservative caps + omission of oversized values (fallback to *_PATH).

Generated with mux • Model: openai:gpt-5.2 • Thinking: xhigh • Cost: $14.56

@github-actions github-actions bot added enhancement New feature or functionality docs Improvements or additions to documentation labels Feb 3, 2026
Replace jq parsing with direct $MUX_TOOL_INPUT_FILE_PATH access.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation enhancement New feature or functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant