Commit 11d71fe
feat(mcp): add $history variable and structured response format (nushell#17132)
<img width="1582" height="686" alt="image"
src="https://github.com/user-attachments/assets/538326ec-7ec8-45c0-a59f-f170ea88f5f8"
/>
- Add `$history` variable that stores all previous command outputs
- Access by index: `$history.0`, `$history.1`, etc.
- Wrap all responses in structured record with:
- `history_index`: 0-based index of result in history
- `cwd`: current working directory after command
- `output`: command output (possibly truncated)
- Truncate large outputs (>10k chars by default) and reference history
- Configurable threshold via `NU_MCP_OUTPUT_TRUNCATE` env var
- Remove moka caching (incompatible with history tracking)
- Update instructions.md with history documentation
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.5 <[email protected]>1 parent bfc594e commit 11d71fe
File tree
6 files changed
+405
-96
lines changed- crates/nu-mcp
- src
6 files changed
+405
-96
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
0 commit comments