fix: get_thumbnail size limits, default=small, quality quirk docs (v0.3.5)
- Default size changed large → small (avoids MCP buffer overflows) - Hard limit: return Error: when thumbnail exceeds ~2 MB base64 (1.5 MB raw) - Soft limit: add "warning" field to JSON when thumbnail exceeds ~500 KB base64 (375 KB raw), advising to use size='small' - Constants _THUMB_ABORT_BYTES / _THUMB_WARN_BYTES moved to module level - 6 new tests for size cap/warning/default/DSM-error paths (113 total) - SPEC.md: document quality-ignored quirk, size ranges, soft+hard limits - CLAUDE.md: DSM Quirks entry for Thumb quality/size behaviour Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -460,12 +460,26 @@ pagination hint when more results are available.
|
||||
| Name | Type | Required | Default | Description |
|
||||
|------|------|----------|---------|-------------|
|
||||
| `path` | str | yes | — | Share-relative path to the image or video file |
|
||||
| `size` | str | no | `large` | `small`, `medium`, `large`, or `original` |
|
||||
| `size` | str | no | `small` | `small`, `medium`, `large`, or `original` |
|
||||
|
||||
**Returns:** JSON `{filename, size_bytes, content_base64}` (JPEG bytes encoded as base64).
|
||||
If the thumbnail exceeds the soft limit (≈500 KB base64 / 375 KB raw), the JSON includes
|
||||
an additional `"warning"` field advising to use `size='small'`.
|
||||
If the thumbnail exceeds the hard limit (≈2 MB base64 / 1.5 MB raw), the tool returns
|
||||
`"Error: Thumbnail too large (… KB base64) — use size='small' to get a smaller version."`
|
||||
instead of the JSON payload.
|
||||
|
||||
**DSM call:** `SYNO.FileStation.Thumb::get` (POST, v2)
|
||||
|
||||
> **`quality` parameter is ignored:** DSM accepts `quality` in the request but always
|
||||
> returns the same JPEG regardless of the value. No server-side quality control is available.
|
||||
>
|
||||
> **Size limits confirmed against this NAS:**
|
||||
> - `small` → 5 KB–548 KB raw depending on source image resolution.
|
||||
> - `medium` / `large` → can exceed 380 KB raw even for modest photos.
|
||||
> - `original` → reflects the actual stored image; may be several MB.
|
||||
> Default was changed from `large` to `small` to avoid hitting MCP buffer limits.
|
||||
>
|
||||
> DSM returns image bytes directly when the file has a thumbnail. Non-image content-type
|
||||
> indicates a DSM error envelope — the tool parses and surfaces the error code.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user