image-tiler-mcp-server 1.2.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +137 -7
  2. package/dist/constants.d.ts +11 -0
  3. package/dist/constants.d.ts.map +1 -1
  4. package/dist/constants.js +12 -0
  5. package/dist/constants.js.map +1 -1
  6. package/dist/index.js +4 -0
  7. package/dist/index.js.map +1 -1
  8. package/dist/schemas/index.d.ts +33 -1
  9. package/dist/schemas/index.d.ts.map +1 -1
  10. package/dist/schemas/index.js +90 -3
  11. package/dist/schemas/index.js.map +1 -1
  12. package/dist/services/image-processor.d.ts +5 -3
  13. package/dist/services/image-processor.d.ts.map +1 -1
  14. package/dist/services/image-processor.js +148 -47
  15. package/dist/services/image-processor.js.map +1 -1
  16. package/dist/services/image-source-resolver.d.ts +26 -0
  17. package/dist/services/image-source-resolver.d.ts.map +1 -0
  18. package/dist/services/image-source-resolver.js +206 -0
  19. package/dist/services/image-source-resolver.js.map +1 -0
  20. package/dist/services/interactive-preview-generator.d.ts +13 -0
  21. package/dist/services/interactive-preview-generator.d.ts.map +1 -0
  22. package/dist/services/interactive-preview-generator.js +181 -0
  23. package/dist/services/interactive-preview-generator.js.map +1 -0
  24. package/dist/tools/prepare-image.d.ts +3 -0
  25. package/dist/tools/prepare-image.d.ts.map +1 -0
  26. package/dist/tools/prepare-image.js +225 -0
  27. package/dist/tools/prepare-image.js.map +1 -0
  28. package/dist/tools/recommend-settings.d.ts +3 -0
  29. package/dist/tools/recommend-settings.d.ts.map +1 -0
  30. package/dist/tools/recommend-settings.js +198 -0
  31. package/dist/tools/recommend-settings.js.map +1 -0
  32. package/dist/tools/tile-image.d.ts.map +1 -1
  33. package/dist/tools/tile-image.js +96 -25
  34. package/dist/tools/tile-image.js.map +1 -1
  35. package/dist/types.d.ts +47 -0
  36. package/dist/types.d.ts.map +1 -1
  37. package/dist/utils.d.ts +2 -0
  38. package/dist/utils.d.ts.map +1 -0
  39. package/dist/utils.js +9 -0
  40. package/dist/utils.js.map +1 -0
  41. package/package.json +1 -1
  42. package/dist/services/preview-generator.d.ts +0 -3
  43. package/dist/services/preview-generator.d.ts.map +0 -1
  44. package/dist/services/preview-generator.js +0 -142
  45. package/dist/services/preview-generator.js.map +0 -1
package/README.md CHANGED
@@ -3,10 +3,10 @@
3
3
  Split large images into optimally-sized tiles so LLM vision models see every detail — no downscaling, no lost text.
4
4
 
5
5
  <p align="center">
6
- <img src="assets/preview.webp" alt="Preview of image tiling grid for veguitas.com" width="100%" />
6
+ <img src="assets/preview.gif" alt="Preview of image tiling grid with advised vision models size and token estimates" width="100%" />
7
7
  </p>
8
8
 
9
- ## Why tiling matters
9
+ ## Tiling for LLM Vision
10
10
 
11
11
  LLM vision systems have a **maximum input resolution**. When you send an image larger than that limit, the model silently downscales it before processing. A 3600×22810 full-page screenshot gets shrunk to ~247×1568 by Claude — text becomes unreadable, UI details disappear, and the model can't analyze what it can't see.
12
12
 
@@ -20,7 +20,7 @@ LLM vision systems have a **maximum input resolution**. When you send an image l
20
20
 
21
21
  Each tile is processed at **full resolution** — no downscaling — preserving text, UI elements, and fine detail across the entire image.
22
22
 
23
- See [sample of generated tiles here.](https://github.com/keiver/image-tiler-mcp-server/tree/main/assets/tiles/)
23
+ **Auto-downscaling:** Images over 10,000px on their longest side are automatically downscaled before tiling (configurable via `maxDimension`). This prevents extreme tile counts on very long screenshots — e.g., a 3600×22810 page drops from 84 tiles / ~134K tokens to 20 tiles / ~32K tokens with no visible quality loss. Set `maxDimension=0` to disable.
24
24
 
25
25
  ### Supported Models
26
26
 
@@ -43,11 +43,17 @@ Splits a large image into tiles and saves them to disk.
43
43
 
44
44
  | Parameter | Type | Required | Default | Description |
45
45
  |---|---|---|---|---|
46
- | `filePath` | string | yes | — | Absolute or relative path to the image file |
46
+ | `filePath` | string | no* | — | Absolute or relative path to the image file |
47
+ | `sourceUrl` | string | no* | — | HTTPS URL to download the image from (max 50MB, 30s timeout) |
48
+ | `dataUrl` | string | no* | — | Data URL with base64-encoded image |
49
+ | `imageBase64` | string | no* | — | Raw base64-encoded image data |
47
50
  | `model` | string | no | `"claude"` | Target vision model: `"claude"`, `"openai"`, `"gemini"`, `"gemini3"` |
48
51
  | `tileSize` | number | no | Model default | Tile size in pixels. Clamped to model min/max with a warning if out of bounds. |
52
+ | `maxDimension` | number | no | `10000` | Max dimension in px (0-65536). Pre-downscales the image so its longest side fits within this value before tiling. Defaults to 10000px. Set to 0 to disable auto-downscaling. No-op if already within bounds. |
49
53
  | `outputDir` | string | no | `tiles/{name}` subfolder next to source | Directory to save tiles |
50
54
 
55
+ *At least one image source (`filePath`, `sourceUrl`, `dataUrl`, or `imageBase64`) is required.
56
+
51
57
  Returns JSON metadata with grid dimensions, tile count, model used, estimated token cost, and per-tile file paths.
52
58
 
53
59
  ### `tiler_get_tiles`
@@ -62,6 +68,46 @@ Returns tile images as base64 in batches of 5 for the LLM to see directly.
62
68
 
63
69
  Returns text labels + image content blocks. Includes pagination hint for the next batch.
64
70
 
71
+ ### `tiler_recommend_settings`
72
+
73
+ Dry-run estimator: reads image dimensions and returns cost estimates **without tiling**.
74
+
75
+ | Parameter | Type | Required | Default | Description |
76
+ |---|---|---|---|---|
77
+ | `filePath` | string | no* | — | Path to image file |
78
+ | `sourceUrl` | string | no* | — | HTTPS URL to download from |
79
+ | `dataUrl` | string | no* | — | Data URL with base64 image |
80
+ | `imageBase64` | string | no* | — | Raw base64 image data |
81
+ | `model` | string | no | `"claude"` | Target vision model |
82
+ | `tileSize` | number | no | Model default | Override tile size (skips heuristics) |
83
+ | `maxDimension` | number | no | — | Override max dimension (skips heuristics) |
84
+ | `intent` | string | no | — | `"text_heavy"`, `"ui_screenshot"`, `"diagram"`, `"photo"`, `"general"` |
85
+ | `budget` | string | no | — | `"low"`, `"default"`, `"max_detail"` |
86
+
87
+ *At least one image source required.
88
+
89
+ Returns JSON with recommended settings, rationale, image info, grid estimate, and a comparison across all 4 models.
90
+
91
+ ### `tiler_prepare_image`
92
+
93
+ One-shot convenience tool: tiles an image AND returns the first batch of tiles in a single call.
94
+
95
+ | Parameter | Type | Required | Default | Description |
96
+ |---|---|---|---|---|
97
+ | `filePath` | string | no* | — | Path to image file |
98
+ | `sourceUrl` | string | no* | — | HTTPS URL to download from |
99
+ | `dataUrl` | string | no* | — | Data URL with base64 image |
100
+ | `imageBase64` | string | no* | — | Raw base64 image data |
101
+ | `model` | string | no | `"claude"` | Target vision model |
102
+ | `tileSize` | number | no | Model default | Override tile size |
103
+ | `maxDimension` | number | no | `10000` | Max dimension for auto-downscaling |
104
+ | `outputDir` | string | no | `tiles/{name}` subfolder | Directory to save tiles |
105
+ | `page` | number | no | `0` | Tile page (0 = tiles 0-4, 1 = tiles 5-9, etc.) |
106
+
107
+ *At least one image source required.
108
+
109
+ Returns tiling metadata + up to 5 tile images inline. Saves a round-trip compared to calling `tiler_tile_image` then `tiler_get_tiles` separately.
110
+
65
111
  ## Installation
66
112
 
67
113
  ### Claude Code
@@ -179,6 +225,77 @@ Claude will:
179
225
  2. Tiles sized at 768px for OpenAI's vision pipeline
180
226
  ```
181
227
 
228
+ ### Auto-Downscaling
229
+
230
+ Images over 10,000px are automatically downscaled before tiling. You can customize the limit:
231
+
232
+ ```
233
+ > Tile this 7680x4032 screenshot but downscale to 2048px first to save tokens
234
+
235
+ Claude will:
236
+ 1. Call tiler_tile_image(filePath="./image.png", maxDimension=2048)
237
+ 2. Image is downscaled to 2048x1076 before tiling
238
+ 3. Fewer tiles = lower token cost (e.g., 4 tiles instead of 32)
239
+ ```
240
+
241
+ To disable auto-downscaling entirely:
242
+
243
+ ```
244
+ > Tile this image at full resolution, no downscaling
245
+
246
+ Claude will:
247
+ 1. Call tiler_tile_image(filePath="./image.png", maxDimension=0)
248
+ 2. Image is tiled at its original dimensions
249
+ ```
250
+
251
+ ### Estimating Costs
252
+
253
+ Use `tiler_recommend_settings` to preview token costs before tiling:
254
+
255
+ ```
256
+ > How many tokens would it cost to tile this 3600x22810 screenshot?
257
+
258
+ Claude will:
259
+ 1. Call tiler_recommend_settings(filePath="./screenshot.png")
260
+ 2. See cost estimates for all 4 models
261
+ 3. Make an informed decision before committing to tiling
262
+ ```
263
+
264
+ With intent and budget hints:
265
+
266
+ ```
267
+ > Estimate costs for this long document screenshot, keeping tokens low
268
+
269
+ Claude will:
270
+ 1. Call tiler_recommend_settings(filePath="./doc.png", intent="text_heavy", budget="low")
271
+ 2. Get optimized maxDimension recommendation for text-heavy content
272
+ ```
273
+
274
+ ### Using URLs / Base64
275
+
276
+ All image-accepting tools (`tiler_tile_image`, `tiler_recommend_settings`, `tiler_prepare_image`) support multiple input sources:
277
+
278
+ ```
279
+ > Tile this image from a URL
280
+ → tiler_tile_image(sourceUrl="https://example.com/screenshot.png")
281
+
282
+ > Tile this base64 image
283
+ → tiler_tile_image(imageBase64="iVBORw0KGgo...")
284
+ ```
285
+
286
+ ### One-Shot Usage
287
+
288
+ Use `tiler_prepare_image` to tile and get the first batch in one call:
289
+
290
+ ```
291
+ > Analyze this screenshot
292
+
293
+ Claude will:
294
+ 1. Call tiler_prepare_image(filePath="./screenshot.png")
295
+ 2. Get tiling metadata + first 5 tiles in a single response
296
+ 3. Continue with tiler_get_tiles for remaining tiles if needed
297
+ ```
298
+
182
299
  ### Typical Workflow
183
300
 
184
301
  1. Capture full-page screenshot with your browser extension
@@ -250,10 +367,19 @@ assets/tiles/landscape/
250
367
  { "index": 1, "row": 0, "col": 1, "position": "1092,0", "dimensions": "1092×1092", "filePath": "/path/to/assets/tiles/landscape/tile_000_001.png" },
251
368
  "... 30 more tiles"
252
369
  ],
253
- "previewPath": "/path/to/assets/tiles/landscape/preview.html"
370
+ "previewPath": "/path/to/assets/tiles/landscape/preview.html",
371
+ "resize": {
372
+ "originalWidth": 7680,
373
+ "originalHeight": 4032,
374
+ "resizedWidth": 2048,
375
+ "resizedHeight": 1076,
376
+ "scaleFactor": 0.267
377
+ }
254
378
  }
255
379
  ```
256
380
 
381
+ > The `resize` field is only present when `maxDimension` triggered an actual downscale. If the image was already within bounds, it's omitted.
382
+
257
383
  ### Portrait example
258
384
 
259
385
  `assets/portrait.png` (3600x22810) tiled with Claude defaults produces a 4x21 grid of 84 tiles (~133,560 tokens).
@@ -339,9 +465,13 @@ PNG, JPEG, WebP, TIFF, GIF
339
465
 
340
466
  ## Security
341
467
 
342
- This is a **local MCP server** that runs on your machine via stdio. It operates with the same filesystem permissions as the MCP client process that spawns it. File paths provided to the tools are resolved and accessed directly — there is no sandboxing or path restriction beyond your OS-level permissions.
468
+ This is a **local MCP server** designed to run on your machine via stdio. It operates with the same filesystem permissions as the MCP client process that spawns it.
469
+
470
+ **Trust model:** This server trusts its MCP client. Path parameters (`filePath`, `outputDir`, `tilesDir`) are resolved and accessed directly — there is no sandboxing or path restriction beyond your OS-level permissions. This is expected for local MCP tools where the client (e.g. Claude Code) already has filesystem access.
471
+
472
+ **URL downloads:** When using `sourceUrl`, the server fetches images over HTTPS only (no HTTP). Downloads are limited to 50MB with a 30-second timeout. Content-Type is validated — non-image responses (text/html, application/json, etc.) are rejected with a clear error. Downloaded files are written to a temp directory and cleaned up after processing. The server does not send any data externally — it only receives. No private/internal IP validation is performed on URLs.
343
473
 
344
- This is by design: MCP tools run in the user's security context, same as any CLI tool. No network access, no remote connections, no data sent externally.
474
+ **If deploying remotely:** This server is not designed for multi-tenant or network-exposed environments. If you expose it beyond local stdio, you should add path validation (restrict to allowed directories), SSRF protection (block private IP ranges like 127.0.0.0/8, 10.0.0.0/8, 169.254.169.254), and authentication.
345
475
 
346
476
  ## Requirements
347
477
 
@@ -18,4 +18,15 @@ export declare const MAX_TOTAL_TILES = 10000;
18
18
  export declare const MAX_TILES_PER_BATCH = 5;
19
19
  export declare const SUPPORTED_FORMATS: readonly ["png", "jpeg", "jpg", "webp", "tiff", "gif"];
20
20
  export declare const PNG_COMPRESSION_LEVEL = 6;
21
+ export declare const DEFAULT_MAX_DIMENSION = 10000;
22
+ export declare const MAX_DOWNLOAD_SIZE_BYTES: number;
23
+ export declare const DOWNLOAD_TIMEOUT_MS = 30000;
24
+ export declare const ALLOWED_URL_PROTOCOLS: readonly ["https:"];
25
+ export declare const MAX_BASE64_LENGTH = 67108864;
26
+ export declare const MAX_DATA_URL_LENGTH: number;
27
+ export declare const MIN_REMAINDER_RATIO = 0.15;
28
+ export declare const IMAGE_INTENTS: readonly ["text_heavy", "ui_screenshot", "diagram", "photo", "general"];
29
+ export type ImageIntent = (typeof IMAGE_INTENTS)[number];
30
+ export declare const BUDGET_LEVELS: readonly ["low", "default", "max_detail"];
31
+ export type BudgetLevel = (typeof BUDGET_LEVELS)[number];
21
32
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,oDAAqD,CAAC;AAChF,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,MAAM,WAAW,iBAAiB;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,WAAW,EAAE,iBAAiB,CA6BhE,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,WAAsB,CAAC;AAGnD,eAAO,MAAM,iBAAiB,QAAuC,CAAC;AACtE,eAAO,MAAM,aAAa,QAAmC,CAAC;AAC9D,eAAO,MAAM,aAAa,QAAmC,CAAC;AAC9D,eAAO,MAAM,eAAe,QAAqC,CAAC;AAElE,eAAO,MAAM,mBAAmB,QAAQ,CAAC;AACzC,eAAO,MAAM,eAAe,QAAQ,CAAC;AACrC,eAAO,MAAM,mBAAmB,IAAI,CAAC;AACrC,eAAO,MAAM,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MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAEzD,eAAO,MAAM,aAAa,2CAA4C,CAAC;AACvE,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC"}
package/dist/constants.js CHANGED
@@ -40,4 +40,16 @@ export const MAX_TOTAL_TILES = 10000;
40
40
  export const MAX_TILES_PER_BATCH = 5;
41
41
  export const SUPPORTED_FORMATS = ["png", "jpeg", "jpg", "webp", "tiff", "gif"];
42
42
  export const PNG_COMPRESSION_LEVEL = 6;
43
+ export const DEFAULT_MAX_DIMENSION = 10000;
44
+ // Image source resolution
45
+ export const MAX_DOWNLOAD_SIZE_BYTES = 50 * 1024 * 1024; // 50 MB
46
+ export const DOWNLOAD_TIMEOUT_MS = 30_000; // 30 seconds
47
+ export const ALLOWED_URL_PROTOCOLS = ["https:"];
48
+ export const MAX_BASE64_LENGTH = 67_108_864; // ~50MB decoded (base64 is ~4/3x)
49
+ export const MAX_DATA_URL_LENGTH = MAX_BASE64_LENGTH + 256; // base64 payload + data URL prefix overhead
50
+ // Remainder absorption: if a remainder strip is < 15% of tileSize, absorb it into the last tile
51
+ export const MIN_REMAINDER_RATIO = 0.15;
52
+ // Intent and budget enums for recommend-settings
53
+ export const IMAGE_INTENTS = ["text_heavy", "ui_screenshot", "diagram", "photo", "general"];
54
+ export const BUDGET_LEVELS = ["low", "default", "max_detail"];
43
55
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,CAAU,CAAC;AAWhF,MAAM,CAAC,MAAM,aAAa,GAA2C;IACnE,MAAM,EAAE;QACN,eAAe,EAAE,IAAI;QACrB,WAAW,EAAE,GAAG;QAChB,WAAW,EAA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GAAG,CAAC,CAAC;AACrC,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AACxF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AACvC,MAAM,CAAC,MAAM,qBAAqB,GAAG,KAAK,CAAC;AAE3C,0BAA0B;AAC1B,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC,QAAQ;AACjE,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,CAAC,aAAa;AACxD,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAQ,CAAU,CAAC;AACzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC,CAAC,kCAAkC;AAC/E,MAAM,CAAC,MAAM,mBAAmB,GAAG,iBAAiB,GAAG,GAAG,CAAC,CAAC,4CAA4C;AAExG,gGAAgG;AAChG,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC;AAExC,iDAAiD;AACjD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AAGrG,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,SAAS,EAAE,YAAY,CAAU,CAAC"}
package/dist/index.js CHANGED
@@ -4,6 +4,8 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
4
4
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
5
  import { registerTileImageTool } from "./tools/tile-image.js";
6
6
  import { registerGetTilesTool } from "./tools/get-tiles.js";
7
+ import { registerRecommendSettingsTool } from "./tools/recommend-settings.js";
8
+ import { registerPrepareImageTool } from "./tools/prepare-image.js";
7
9
  const require = createRequire(import.meta.url);
8
10
  const { version } = require("../package.json");
9
11
  const server = new McpServer({
@@ -12,6 +14,8 @@ const server = new McpServer({
12
14
  });
13
15
  registerTileImageTool(server);
14
16
  registerGetTilesTool(server);
17
+ registerRecommendSettingsTool(server);
18
+ registerPrepareImageTool(server);
15
19
  async function runStdio() {
16
20
  const transport = new StdioServerTransport();
17
21
  await server.connect(transport);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,iBAAiB,CAAwB,CAAC;AAEtE,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,wBAAwB;IAC9B,OAAO;CACR,CAAC,CAAC;AAEH,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAC9B,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAE7B,KAAK,UAAU,QAAQ;IACrB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;AAC3D,CAAC;AAED,KAAK,UAAU,QAAQ;IACrB,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,OAAO,CAAC,EAAE,CAAC,QA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AO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;AAC3D,CAAC;AAED,KAAK,UAAU,QAAQ;IACrB,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAEhC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAClC,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -1,13 +1,45 @@
1
1
  import { z } from "zod";
2
+ export declare const imageSourceFields: {
3
+ filePath: z.ZodOptional<z.ZodString>;
4
+ sourceUrl: z.ZodOptional<z.ZodString>;
5
+ dataUrl: z.ZodOptional<z.ZodString>;
6
+ imageBase64: z.ZodOptional<z.ZodString>;
7
+ };
2
8
  export declare const TileImageInputSchema: {
3
- filePath: z.ZodString;
4
9
  model: z.ZodDefault<z.ZodEnum<["claude", "openai", "gemini", "gemini3"]>>;
5
10
  tileSize: z.ZodOptional<z.ZodNumber>;
11
+ maxDimension: z.ZodDefault<z.ZodNumber>;
6
12
  outputDir: z.ZodOptional<z.ZodString>;
13
+ filePath: z.ZodOptional<z.ZodString>;
14
+ sourceUrl: z.ZodOptional<z.ZodString>;
15
+ dataUrl: z.ZodOptional<z.ZodString>;
16
+ imageBase64: z.ZodOptional<z.ZodString>;
7
17
  };
8
18
  export declare const GetTilesInputSchema: {
9
19
  tilesDir: z.ZodString;
10
20
  start: z.ZodDefault<z.ZodNumber>;
11
21
  end: z.ZodOptional<z.ZodNumber>;
12
22
  };
23
+ export declare const RecommendSettingsInputSchema: {
24
+ model: z.ZodOptional<z.ZodEnum<["claude", "openai", "gemini", "gemini3"]>>;
25
+ tileSize: z.ZodOptional<z.ZodNumber>;
26
+ maxDimension: z.ZodOptional<z.ZodNumber>;
27
+ intent: z.ZodOptional<z.ZodEnum<["text_heavy", "ui_screenshot", "diagram", "photo", "general"]>>;
28
+ budget: z.ZodOptional<z.ZodEnum<["low", "default", "max_detail"]>>;
29
+ filePath: z.ZodOptional<z.ZodString>;
30
+ sourceUrl: z.ZodOptional<z.ZodString>;
31
+ dataUrl: z.ZodOptional<z.ZodString>;
32
+ imageBase64: z.ZodOptional<z.ZodString>;
33
+ };
34
+ export declare const PrepareImageInputSchema: {
35
+ model: z.ZodDefault<z.ZodEnum<["claude", "openai", "gemini", "gemini3"]>>;
36
+ tileSize: z.ZodOptional<z.ZodNumber>;
37
+ maxDimension: z.ZodDefault<z.ZodNumber>;
38
+ outputDir: z.ZodOptional<z.ZodString>;
39
+ page: z.ZodDefault<z.ZodNumber>;
40
+ filePath: z.ZodOptional<z.ZodString>;
41
+ sourceUrl: z.ZodOptional<z.ZodString>;
42
+ dataUrl: z.ZodOptional<z.ZodString>;
43
+ imageBase64: z.ZodOptional<z.ZodString>;
44
+ };
13
45
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBxB,eAAO,MAAM,oBAAoB;;;;;CA6BhC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;CAqB/B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAuBxB,eAAO,MAAM,iBAAiB;;;;;CAqB7B,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;CAmChC,CAAC;AAEF,eAAO,MAAM,mBAAmB;;;;CAqB/B,CAAC;AAEF,eAAO,MAAM,4BAA4B;;;;;;;;;;CA8BxC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;CAoCnC,CAAC"}
@@ -1,12 +1,32 @@
1
1
  import { z } from "zod";
2
- import { MAX_IMAGE_DIMENSION, MAX_TILES_PER_BATCH, VISION_MODELS, DEFAULT_MODEL, MODEL_CONFIGS, } from "../constants.js";
2
+ import { MAX_IMAGE_DIMENSION, MAX_TILES_PER_BATCH, VISION_MODELS, DEFAULT_MODEL, MODEL_CONFIGS, DEFAULT_MAX_DIMENSION, MAX_BASE64_LENGTH, MAX_DATA_URL_LENGTH, IMAGE_INTENTS, BUDGET_LEVELS, } from "../constants.js";
3
3
  const modelDescriptions = VISION_MODELS.map((m) => `"${m}" (${MODEL_CONFIGS[m].defaultTileSize}px tiles, ~${MODEL_CONFIGS[m].tokensPerTile} tokens/tile)`).join(", ");
4
4
  const defaultDescriptions = VISION_MODELS.map((m) => `${MODEL_CONFIGS[m].label}: ${MODEL_CONFIGS[m].defaultTileSize}`).join(", ");
5
- export const TileImageInputSchema = {
5
+ // Shared image source fields — used by tile-image, recommend-settings, and prepare-image
6
+ export const imageSourceFields = {
6
7
  filePath: z
7
8
  .string()
8
9
  .min(1, "File path cannot be empty")
9
- .describe("Absolute or relative path to the image file to tile"),
10
+ .optional()
11
+ .describe("Absolute or relative path to the image file"),
12
+ sourceUrl: z
13
+ .string()
14
+ .url("Must be a valid URL")
15
+ .optional()
16
+ .describe("HTTPS URL to download the image from (max 50MB, 30s timeout)"),
17
+ dataUrl: z
18
+ .string()
19
+ .max(MAX_DATA_URL_LENGTH, `Data URL must not exceed ${MAX_DATA_URL_LENGTH} characters`)
20
+ .optional()
21
+ .describe('Data URL with base64-encoded image (e.g. "data:image/png;base64,...")'),
22
+ imageBase64: z
23
+ .string()
24
+ .max(MAX_BASE64_LENGTH, `Base64 string must not exceed ${MAX_BASE64_LENGTH} characters`)
25
+ .optional()
26
+ .describe("Raw base64-encoded image data (no data URL prefix)"),
27
+ };
28
+ export const TileImageInputSchema = {
29
+ ...imageSourceFields,
10
30
  model: z
11
31
  .enum(VISION_MODELS)
12
32
  .default(DEFAULT_MODEL)
@@ -18,6 +38,13 @@ export const TileImageInputSchema = {
18
38
  .max(MAX_IMAGE_DIMENSION, `Tile size must not exceed ${MAX_IMAGE_DIMENSION}px`)
19
39
  .optional()
20
40
  .describe(`Tile size in pixels. If omitted, uses the model's optimal default (${defaultDescriptions}). Values outside the model's supported range are automatically clamped with a warning.`),
41
+ maxDimension: z
42
+ .number()
43
+ .int()
44
+ .min(0, "maxDimension must be >= 0 (0 disables auto-downscaling)")
45
+ .max(MAX_IMAGE_DIMENSION, `maxDimension must not exceed ${MAX_IMAGE_DIMENSION}px`)
46
+ .default(DEFAULT_MAX_DIMENSION)
47
+ .describe(`Max dimension in px (256-${MAX_IMAGE_DIMENSION}). When set, the image is resized so its longest side fits within this value before tiling. Reduces token consumption for large images. Defaults to ${DEFAULT_MAX_DIMENSION}px. Set to 0 to disable auto-downscaling.`),
21
48
  outputDir: z
22
49
  .string()
23
50
  .optional()
@@ -41,4 +68,64 @@ export const GetTilesInputSchema = {
41
68
  .optional()
42
69
  .describe(`End tile index (0-based, inclusive). Defaults to start + ${MAX_TILES_PER_BATCH - 1}. Max ${MAX_TILES_PER_BATCH} tiles per batch to stay within MCP response limits`),
43
70
  };
71
+ export const RecommendSettingsInputSchema = {
72
+ ...imageSourceFields,
73
+ model: z
74
+ .enum(VISION_MODELS)
75
+ .optional()
76
+ .describe(`Target vision model. If omitted, recommendations use the default ("${DEFAULT_MODEL}") but all-model comparison is always returned.`),
77
+ tileSize: z
78
+ .number()
79
+ .int()
80
+ .min(1, "Tile size must be a positive integer")
81
+ .max(MAX_IMAGE_DIMENSION, `Tile size must not exceed ${MAX_IMAGE_DIMENSION}px`)
82
+ .optional()
83
+ .describe("Override tile size. If provided, skips tile-size heuristics."),
84
+ maxDimension: z
85
+ .number()
86
+ .int()
87
+ .min(0, "maxDimension must be >= 0 (0 disables auto-downscaling)")
88
+ .max(MAX_IMAGE_DIMENSION, `maxDimension must not exceed ${MAX_IMAGE_DIMENSION}px`)
89
+ .optional()
90
+ .describe("Override max dimension. If provided, skips maxDimension heuristics."),
91
+ intent: z
92
+ .enum(IMAGE_INTENTS)
93
+ .optional()
94
+ .describe('Image intent hint: "text_heavy", "ui_screenshot", "diagram", "photo", or "general". Affects heuristic recommendations.'),
95
+ budget: z
96
+ .enum(BUDGET_LEVELS)
97
+ .optional()
98
+ .describe('Token budget preference: "low" (fewer tokens), "default", or "max_detail" (preserve all detail).'),
99
+ };
100
+ export const PrepareImageInputSchema = {
101
+ ...imageSourceFields,
102
+ model: z
103
+ .enum(VISION_MODELS)
104
+ .default(DEFAULT_MODEL)
105
+ .describe(`Target vision model: ${modelDescriptions}. Default: "${DEFAULT_MODEL}"`),
106
+ tileSize: z
107
+ .number()
108
+ .int()
109
+ .min(1, "Tile size must be a positive integer")
110
+ .max(MAX_IMAGE_DIMENSION, `Tile size must not exceed ${MAX_IMAGE_DIMENSION}px`)
111
+ .optional()
112
+ .describe(`Tile size in pixels. If omitted, uses the model's optimal default (${defaultDescriptions}).`),
113
+ maxDimension: z
114
+ .number()
115
+ .int()
116
+ .min(0, "maxDimension must be >= 0 (0 disables auto-downscaling)")
117
+ .max(MAX_IMAGE_DIMENSION, `maxDimension must not exceed ${MAX_IMAGE_DIMENSION}px`)
118
+ .default(DEFAULT_MAX_DIMENSION)
119
+ .describe(`Max dimension in px. Defaults to ${DEFAULT_MAX_DIMENSION}px. Set to 0 to disable.`),
120
+ outputDir: z
121
+ .string()
122
+ .optional()
123
+ .describe("Directory to save tiles. Defaults to a 'tiles' subfolder next to the source image"),
124
+ page: z
125
+ .number()
126
+ .int()
127
+ .min(0, "Page must be >= 0")
128
+ .default(0)
129
+ .describe("Tile page to return (0 = first 5, 1 = next 5, etc.). Default: 0"),
130
+ };
44
131
  //# sour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,EAAE;SACR,GAAG,EAAE;SACL,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC;SAC3B,OAAO,CAAC,CAAC,CAAC;SACV,QAAQ,CAAC,iEAAiE,CAAC;CAC/E,CAAC"}
@@ -1,7 +1,9 @@
1
- import type { ImageMetadata, TileGridInfo, TileImageResult } from "../types.js";
1
+ import type { ImageMetadata, ResizeInfo, TileGridInfo, TileImageResult, ModelEstimate } from "../types.js";
2
2
  export declare function getImageMetadata(filePath: string): Promise<ImageMetadata>;
3
- export declare function calculateGrid(width: number, height: number, tileSize: number, tokensPerTile?: number): TileGridInfo;
4
- export declare function tileImage(filePath: string, tileSize: number, outputDir: string, tokensPerTile?: number): Promise<TileImageResult>;
3
+ export declare function calculateGrid(width: number, height: number, tileSize: number, tokensPerTile?: number, maxTileSize?: number): TileGridInfo;
4
+ export declare function computeEstimateForModel(modelKey: string, imageWidth: number, imageHeight: number, overrideTileSize?: number, effectiveMaxDimension?: number): ModelEstimate;
5
+ export declare function resizeImage(filePath: string, maxDimension: number, outputPath: string): Promise<ResizeInfo | null>;
6
+ export declare function tileImage(filePath: string, tileSize: number, outputDir: string, tokensPerTile?: number, maxDimension?: number, maxTileSize?: number): Promise<TileImageResult>;
5
7
  export declare function readTileAsBase64(tilePath: string): Promise<string>;
6
8
  export declare function listTilesInDirectory(tilesDir: string): Promise<string[]>;
7
9
  //# sourceMappingURL=image-processor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"image-processor.d.ts","sourceRoot":"","sources":["../../src/services/image-processor.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAY,eAAe,EAAE,MAAM,aAAa,CAAC;AAK1F,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,aAAa,CAAC,CAwBxB;AAED,wBAAgB,aAAa,CAC3B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,aA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