Commit 7f36891
Add line limit parsing and output retrieval mechanism (#26)
* Add line limit parsing and output retrieval mechanism
- Add server-side output storage with unique IDs
- Modify execute_code to support line_limit parameter (default: 30)
- Modify install_packages to support line_limit parameter (default: 30)
- Implement read_output tool for paginated access to stored outputs
- Add warnings for unlimited output requests (-1 line_limit)
- Add comprehensive test suite for new functionality
- Store full outputs and provide truncated responses when needed
- Support line range retrieval (start/end parameters) in read_output
Resolves #24
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-authored-by: Ilan F. S. Theodoro <ilan-theodoro@users.noreply.github.com>
* fix(server): include exception summary in truncated stderr from execute_code
Append exception summary when output is truncated so tests detect the exception type. Verified via uv run pytest -v (189 passed). Minor formatting cleanups.
* chore(server): cap output storage and use ISO8601 UTC timestamps
Implements _MAX_OUTPUT_ITEMS (env NAPARI_MCP_MAX_OUTPUT_ITEMS) with oldest-eviction and switches stored output timestamps to timezone-aware ISO8601. Also fixes imports in tests to use init_viewer/close_viewer. All tests pass (uv run pytest). Addresses PR review comments.
* feat(server): normalize line_limit and add tests for 0 and < -1
_truncate_output now coerces invalid values to safe defaults and treats line_limit < -1 as unlimited (-1). Added tests for 0 and -2. All tests pass (191).
* fix(server): normalize start/end in read_output and avoid double newlines
Cast start/end to int with defaults and only insert a separator newline between stdout/stderr when needed. All tests passing (191).
---------
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Ilan F. S. Theodoro <ilan-theodoro@users.noreply.github.com>1 parent 08e33be commit 7f36891
6 files changed
Lines changed: 649 additions & 22 deletions
File tree
- .github/workflows
- src/napari_mcp
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
| 216 | + | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| |||
0 commit comments