@crawlbrulee/mcp 1.2.0 → 1.3.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 (3) hide show
  1. package/README.md +55 -26
  2. package/dist/index.js +104 -13
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -91,6 +91,33 @@ html, raw html, links, images, screenshot, page metadata).
91
91
 
92
92
  `zero_data_retention` (boolean, default `false`) keeps the result out of the shared cache; anything stored to deliver it is kept for 24 hours, then deleted. it adds 1 credit and must be enabled for your organization. `scrape_async` takes it too. see [zero data retention](https://crawlbrulee.com/docs/zero-data-retention).
93
93
 
94
+ **named values with `extract.elements`.** to pull a few values from a page — prices, titles, links — give each one a name and a CSS selector, instead of reading the whole markdown. they come back in `elements` under the same names. `all: true` returns every match as a list, and `fields` reads named values inside each match. it costs no extra credits. `scrape_async` takes it too.
95
+
96
+ ```jsonc
97
+ {
98
+ "url": "https://books.toscrape.com/",
99
+ "extract": {
100
+ "elements": {
101
+ "heading": "h1",
102
+ "books": {
103
+ "selector": "article.product_pod",
104
+ "all": true,
105
+ "fields": {
106
+ "title": { "selector": "h3 a", "output": "attribute", "attribute": "title" },
107
+ "price": ".price_color",
108
+ },
109
+ },
110
+ },
111
+ },
112
+ }
113
+ // → "elements": {
114
+ // "heading": "All products",
115
+ // "books": [{ "title": "A Light in the Attic", "price": "£51.77" }, ...]
116
+ // }
117
+ ```
118
+
119
+ a name with no match is `null` (or `[]` with `all: true`). limits and selector rules: see [elements](https://crawlbrulee.com/docs/scrape/elements).
120
+
94
121
  **output** — full scrape result. page metadata (title, OG tags, etc.) is returned under `metadata`. extracted `images` are returned as absolute urls — query strings are preserved, and relative `src`s are resolved against the page url. screenshots are returned as signed download urls the agent can fetch separately. in rare cases a screenshot can't be captured: when you requested other outputs too, the `screenshot` field is simply left out while the rest is still returned — but a screenshot-only call that can't deliver errors instead (`unsupported_screenshot_output`, HTTP 422, when the content type can't be screenshotted) and isn't billed. the result also carries `page_status_code` and a top-level `response_meta.usage` block:
95
122
 
96
123
  ```jsonc
@@ -125,9 +152,11 @@ alongside `response_meta.usage`, the result surfaces any non-fatal `warnings`
125
152
  | `links_truncated` | the page had more than 30,000 links; the `links` array is cut at the cap and is incomplete. |
126
153
  | `inline_images_truncated` | the page had more than 10,000 inline images; the `images` array is cut at the cap and is incomplete. |
127
154
  | `raw_html_truncated` | the page body exceeded 10,000,000 characters; `raw_html` is cut at a tag boundary, never mid-tag. |
128
- | `metadata_truncated` | the page head exceeded 2,000,000 characters; `metadata` can be missing tags that sat past the cut. |
155
+ | `elements_truncated` | an `elements` value hit a limit; see [elements](https://crawlbrulee.com/docs/scrape/elements). |
156
+
157
+ one more code is not about size: `screenshot_unavailable` means a screenshot was asked for, but the page came back from the http engine without one. the rest of the result is still there.
129
158
 
130
- and if you requested an extract that doesn't apply to the content type (e.g. `markdown` of a pdf), the field name comes back in an `unsupported_fields` list — with the rest of the payload still returned.
159
+ and if you requested an extract that doesn't apply to the content type (e.g. `metadata` of a JSON file), the field name comes back in an `unsupported_fields` list — with the rest of the payload still returned.
131
160
 
132
161
  every input field, its default, and its constraints are documented under the [scrape endpoint](https://crawlbrulee.com/docs/scrape) — with [extraction](https://crawlbrulee.com/docs/scrape/extraction), [screenshots](https://crawlbrulee.com/docs/scrape/screenshots), [proxies & location](https://crawlbrulee.com/docs/proxies), and [caching](https://crawlbrulee.com/docs/scrape/caching) covering the individual blocks.
133
162
 
@@ -168,7 +197,7 @@ look up the current lifecycle status of an async job: `pending`, `running`, `don
168
197
 
169
198
  ### `scrape_result`
170
199
 
171
- fetch the extracted content of a completed async job — the same result shape as the synchronous `scrape` tool (including `page_status_code`, `metadata` and `response_meta.usage`). errors if the job is still `pending`/`running`, so check `scrape_status` first.
200
+ fetch the extracted content of a completed async job — the same result shape as the synchronous `scrape` tool (including `page_status_code`, `metadata`, `elements` and `response_meta.usage`). errors if the job is still `pending`/`running`, so check `scrape_status` first.
172
201
 
173
202
  ```jsonc
174
203
  { "job_id": "..." }
@@ -240,29 +269,29 @@ a few codes add a short next step after that, e.g. `target_unreachable` and `zer
240
269
 
241
270
  agents can branch on the `errorName` code. the set comes from the sdk's `ApiErrorName` union plus two synthetic codes added by this mcp (`missing_api_key`, `internal_error`):
242
271
 
243
- | code | meaning |
244
- | --------------------------------- | --------------------------------------------------------------------------------------------- |
245
- | `missing_api_key` | `CRAWLBRULEE_API_KEY` is not set in the mcp host's env. |
246
- | `invalid_credentials` | server rejected the api key (revoked, wrong env, etc.). |
247
- | `service_unavailable` | temporary backend failure (HTTP 503). your key is fine — retry with backoff. |
248
- | `too_many_requests` | rate limit hit — back off and retry. |
249
- | `usage_allocation_error` | plan credit / concurrency cap exceeded. show `usage` to user. |
250
- | `validation_error` | input failed server validation. |
251
- | `invalid_url` | target url was rejected before fetching. |
252
- | `blocked_url` | target url is on the blocklist. |
253
- | `antibot_blocked` | origin's anti-bot defenses blocked the fetch. |
254
- | `too_many_redirects` | origin redirected the fetch in a loop (HTTP 422). the target's doing — don't retry blindly. |
255
- | `page_too_large` | the page's html was too large to process (HTTP 422). terminal — never retry it. |
256
- | `target_unreachable` | we could not reach the site at all (HTTP 502). not billed. retry later or check the url. |
257
- | `zero_data_retention_not_enabled` | `zero_data_retention` is not enabled for your organization (HTTP 403). not billed. |
258
- | `scrape_error` | the scrape could not be completed. a page the site served, even a 404, is never this error. |
259
- | `unsupported_screenshot_output` | screenshot-only request on a content type that can't be screenshotted (HTTP 422). not billed. |
260
- | `not_found` | async job ID unknown (e.g. bad `job_id` to `scrape_status` / `scrape_result`). |
261
- | `request_timeout` | network / read timeout. safe to retry. |
262
- | `client_closed_request` | caller cancelled before completion. |
263
- | `internal_server_error` | unhandled server-side failure. |
264
- | `crawlbrulee_error` | sdk error without a typed name. |
265
- | `internal_error` | bug in this mcp — please open an issue. |
272
+ | code | meaning |
273
+ | --------------------------------- | ---------------------------------------------------------------------------------------------- |
274
+ | `missing_api_key` | `CRAWLBRULEE_API_KEY` is not set in the mcp host's env. |
275
+ | `invalid_credentials` | server rejected the api key (revoked, wrong env, etc.). |
276
+ | `service_unavailable` | temporary backend failure (HTTP 503). your key is fine — retry with backoff. |
277
+ | `too_many_requests` | rate limit hit — back off and retry. |
278
+ | `usage_allocation_error` | plan credit / concurrency cap exceeded. show `usage` to user. |
279
+ | `validation_error` | input failed server validation. |
280
+ | `invalid_url` | target url was rejected before fetching. |
281
+ | `blocked_url` | target url is on the blocklist. |
282
+ | `antibot_blocked` | origin's anti-bot defenses blocked the fetch. |
283
+ | `too_many_redirects` | origin redirected the fetch in a loop (HTTP 422). the target's doing — don't retry blindly. |
284
+ | `page_too_large` | the page's html was too large to process (HTTP 422). terminal — never retry it. |
285
+ | `target_unreachable` | we could not reach the site at all (HTTP 502). not billed. retry later or check the url. |
286
+ | `zero_data_retention_not_enabled` | `zero_data_retention` is not enabled for your organization (HTTP 403). not billed. |
287
+ | `scrape_error` | the scrape could not be completed. a page the site served, even a 404, is never this error. |
288
+ | `unsupported_screenshot_output` | screenshot-only request on a content type that can't be screenshotted (HTTP 422). not billed. |
289
+ | `not_found` | async job ID unknown, or submitted more than 24 hours ago (`scrape_status` / `scrape_result`). |
290
+ | `request_timeout` | network / read timeout. safe to retry. |
291
+ | `client_closed_request` | caller cancelled before completion. |
292
+ | `internal_server_error` | unhandled server-side failure. |
293
+ | `crawlbrulee_error` | sdk error without a typed name. |
294
+ | `internal_error` | bug in this mcp — please open an issue. |
266
295
 
267
296
  the api docs carry the canonical [error reference](https://crawlbrulee.com/docs/errors) — every error name, what causes it, and how to recover.
268
297
 
package/dist/index.js CHANGED
@@ -130,6 +130,83 @@ const Schema_ApiScrapeCleanup = z.object({
130
130
  exclude_selectors: z.array(z.string().max(500)).max(100).optional().describe("CSS selectors whose elements are removed before anything is captured. Affects the extracted content and the screenshot, never raw_html. Use it for a banner or widget that ads_and_popups does not recognise. Sending any selector here makes the request skip the cache.")
131
131
  }).strict().describe("What is removed from the page before any output is built. Applies to markdown, cleaned_html, links and images on every engine, and to the screenshot. Never applies to raw_html, which is always the page before we removed anything.");
132
132
 
133
+ //#endregion
134
+ //#region src/schemas/ScrapeElementsSchemas.ts
135
+ /**
136
+ * Mirrors `packages/core/src/model/common/ScrapeElements*` in the server repo.
137
+ * Kept in step by hand — this package deliberately does not import from the
138
+ * monorepo. If the server's shape changes, change it here too.
139
+ *
140
+ * `extract.elements`: named values read from the page by CSS selector. `fields`
141
+ * nests, at most ELEMENT_FIELDS_DEPTH deep. The schemas are built level by level
142
+ * instead of with `z.lazy`, so the depth limit holds by shape and the tool's JSON
143
+ * Schema stays a plain tree (no `$ref`) that every host can read.
144
+ *
145
+ * Only the public per-string limits are checked here. The total selector count, the
146
+ * CSS syntax and the name length are left to the api, which answers a clear 400.
147
+ */
148
+ const ELEMENTS_DOCS_URL = "https://crawlbrulee.com/docs/scrape/elements";
149
+ /** How deep `fields` may nest. The innermost level has no `fields`. */
150
+ const ELEMENT_FIELDS_DEPTH = 3;
151
+ const MAX_ELEMENT_SELECTOR_LENGTH = 500;
152
+ const MAX_ELEMENT_ATTRIBUTE_LENGTH = 100;
153
+ const ELEMENT_OUTPUT_VALUES = [
154
+ "text",
155
+ "html",
156
+ "attribute"
157
+ ];
158
+ const Schema_ElementSelector = z.string().max(500);
159
+ function refineSpec(spec, ctx) {
160
+ if (spec.fields !== void 0) {
161
+ if (spec.output !== void 0 || spec.attribute !== void 0) ctx.addIssue({
162
+ code: "custom",
163
+ path: ["fields"],
164
+ message: "fields cannot be combined with output or attribute: each match becomes an object"
165
+ });
166
+ if (Object.keys(spec.fields).length === 0) ctx.addIssue({
167
+ code: "custom",
168
+ path: ["fields"],
169
+ message: "fields needs at least one field"
170
+ });
171
+ return;
172
+ }
173
+ if (spec.output === "attribute" && !spec.attribute) ctx.addIssue({
174
+ code: "custom",
175
+ path: ["attribute"],
176
+ message: "attribute is required when output is \"attribute\""
177
+ });
178
+ if (spec.output !== "attribute" && spec.attribute !== void 0) ctx.addIssue({
179
+ code: "custom",
180
+ path: ["attribute"],
181
+ message: "attribute is only allowed when output is \"attribute\""
182
+ });
183
+ }
184
+ function describeTop(schema, top, text) {
185
+ return top ? schema.describe(text) : schema;
186
+ }
187
+ /** One `{ name: spec }` map that may still nest `fields` `fieldsDepth` more levels. */
188
+ function buildElementsMap(fieldsDepth, top = false) {
189
+ const spec = z.object({
190
+ selector: describeTop(Schema_ElementSelector, top, "CSS selector, up to 500 characters"),
191
+ output: describeTop(z.enum(ELEMENT_OUTPUT_VALUES).optional(), top, "What to return for a match: `text` (default), `html` (the outer HTML) or `attribute`"),
192
+ attribute: describeTop(z.string().min(1).max(100).optional(), top, "The attribute to read when `output` is `attribute`. `href` and `src` come back as full urls"),
193
+ all: describeTop(z.boolean().default(false), top, "Return every match as a list instead of the first. Defaults to false"),
194
+ ...fieldsDepth > 0 ? { fields: describeTop(buildElementsMap(fieldsDepth - 1).optional(), top, "Used instead of `output`: turns each match into an object of named values, each read inside that match only. Same shape as `elements`; nests up to 3 levels") } : {}
195
+ }).strict().superRefine(refineSpec);
196
+ return z.record(z.string(), z.union([Schema_ElementSelector, spec]));
197
+ }
198
+ const Schema_ScrapeElements = buildElementsMap(3, true);
199
+ /**
200
+ * The answer: name → value. Today a value is a string, an object (`fields`), a
201
+ * list of either (`all: true`), or `null` when nothing matched, nested 3 levels.
202
+ * That shape lives in the field description only. Each value is left open on
203
+ * purpose, like every other response field here: a host checks structured
204
+ * output against this schema, and one value it does not expect (a new output
205
+ * kind, a deeper level) would fail the whole tool call and lose the rest of the
206
+ * result.
207
+ */
208
+ const Schema_ScrapeElementValues = z.record(z.string(), z.unknown());
209
+
133
210
  //#endregion
134
211
  //#region src/schemas/ScrapeScreenshotSchemas.ts
135
212
  const Schema_ApiScrapeScreenshotType = z.enum(["viewport", "full_page"]).describe("Screenshot mode: viewport (visible area) or full_page (entire page)");
@@ -182,13 +259,14 @@ const Schema_ApiScrapeFormatScreenshot = z.object({
182
259
  }).strict().superRefine(refineScrapeScreenshotActionsBefore).describe("Screenshot capture configuration");
183
260
  const Schema_ApiScrapeCache = z.object({ max_age: z.union([z.number().int().nonnegative(), z.iso.datetime()]).default(DEFAULT_API_SCRAPE_CACHE_MAX_AGE_SECONDS).describe("Maximum cache age in seconds, or an ISO 8601 datetime cutoff") }).strict().describe("Cache settings for the scrape request");
184
261
  const Schema_ApiScrapeExtract = z.object({
185
- metadata: z.boolean().default(true).describe("Extract page metadata (title, description, OG tags, etc.). Read from the page head, which is capped at 2,000,000 characters — a larger head is truncated and the response carries a `metadata_truncated` warning."),
262
+ metadata: z.boolean().default(true).describe("Extract page metadata (title, description, OG tags, etc.) from the page head"),
186
263
  cleaned_html: z.boolean().default(true).describe("Extract cleaned HTML (main content only)"),
187
264
  markdown: z.boolean().default(false).describe("Extract page content as clean Markdown"),
188
265
  raw_html: z.boolean().default(false).describe("Return the raw, unprocessed HTML, up to 10,000,000 characters of page body. A larger body is truncated at a tag boundary and the response carries a `raw_html_truncated` warning."),
189
266
  links: z.boolean().default(false).describe("Extract links found on the page, up to 30,000 per page. Beyond that the array is truncated and the response carries a `links_truncated` warning."),
190
267
  images: z.boolean().default(false).describe("Extract inline images found on the page, up to 10,000 per page. Beyond that the array is truncated and the response carries an `inline_images_truncated` warning."),
191
- screenshot: Schema_ApiScrapeFormatScreenshot.optional().describe("Capture a screenshot of the page")
268
+ screenshot: Schema_ApiScrapeFormatScreenshot.optional().describe("Capture a screenshot of the page"),
269
+ elements: Schema_ScrapeElements.optional().describe(`Named values to read from the page by CSS selector, returned in the top-level \`elements\` field under the same names. Each value is either a selector string (the text of the first match) or an object with \`selector\`, \`output\`, \`attribute\` and \`all\`. \`fields\` (instead of \`output\`) turns each match into an object of named values read inside that match only, so a list of product cards can return a title, price and url per card. A name with no match is null, or [] with \`all: true\`. Read after cleanup; \`<script>\` and \`<style>\` tags are not part of it. An invalid selector is a 400. No extra credits, also when the page comes from cache. Limits and selector rules: ${ELEMENTS_DOCS_URL}.`)
192
270
  }).strict().describe("Which content formats to extract from the scraped page");
193
271
  const Schema_ApiScrapeLocation = z.object({
194
272
  locale: z.string().min(2).max(35).optional().describe("BCP-47 locale (2-35 chars, e.g. 'en-US', 'de-DE', 'pt-BR') driving Accept-Language and navigator.language"),
@@ -267,12 +345,12 @@ const Schema_ApiScreenshotProperties = z.looseObject({
267
345
  });
268
346
  const Schema_ApiScreenshotSlice = z.looseObject({
269
347
  row_nr: z.number().describe("Row index of this slice (0-based)"),
270
- url: z.string().describe("URL to download this slice image"),
348
+ url: z.string().describe("Signed link to download this slice image. It expires 24 hours after the scrape (for an async scrape, 24 hours after you submitted it). Download the image, do not keep the link"),
271
349
  type: z.literal("slice").describe("Slice type identifier"),
272
350
  properties: Schema_ApiScreenshotProperties.describe("Image properties for this slice")
273
351
  });
274
352
  const Schema_ApiScreenshotResponse = z.looseObject({
275
- url: z.string().describe("URL to download the full screenshot image"),
353
+ url: z.string().describe("Signed link to download the full screenshot image. It expires 24 hours after the scrape (for an async scrape, 24 hours after you submitted it). Download the image, do not keep the link"),
276
354
  type: openEnum(["viewport", "full_page"]).describe("Screenshot capture mode that was used"),
277
355
  properties: Schema_ApiScreenshotProperties.describe("Image properties for the full screenshot"),
278
356
  slices: z.array(Schema_ApiScreenshotSlice).optional().describe("Individual tile slices (present when slice action_after was requested)")
@@ -338,11 +416,12 @@ const Schema_ApiScrapeSuccessResponse = z.looseObject({
338
416
  markdown: z.string().optional().describe("Page content converted to clean Markdown"),
339
417
  cleaned_html: z.string().optional().describe("Cleaned HTML of the main page content"),
340
418
  raw_html: z.string().optional().describe("Raw, unprocessed HTML of the page"),
419
+ elements: Schema_ScrapeElementValues.optional().describe("The values asked for in `extract.elements`, under the same names. Each name is a string, an object (a spec with `fields`), a list of either (`all: true`), or null when nothing matched (`[]` with `all: true`). An object holds its field names with the same kinds of values, nested up to 3 levels. Every requested name is always present, at every level of `fields`."),
341
420
  images: z.array(Schema_ApiPageInlineImgItem).optional().describe("Inline images found on the page"),
342
421
  links: z.array(Schema_ApiPageLink).optional().describe("Links found on the page"),
343
422
  screenshot: Schema_ApiScreenshotResponse.optional().describe("Screenshot of the page, if requested"),
344
423
  metadata: Schema_ApiScrapeMeta.optional().describe("Extracted page metadata (title, OG tags, etc.)"),
345
- warnings: z.array(z.string()).optional().describe("Non-error notices about the scrape. Truncation codes — `screenshot_truncated` (long page exceeded the scrolling-screenshot height cap), `links_truncated` / `inline_images_truncated` (page had more links/images than the per-page extraction caps), `raw_html_truncated` / `metadata_truncated` (rendered HTML exceeded the per-page size budget) — mean the field is present but capped. Unavailability codes — `links_unavailable` / `inline_images_unavailable` / `metadata_unavailable` — mean that optional field could not be extracted and was omitted (null/empty) while the rest of the scrape succeeded, so an empty field carrying one of these does NOT mean the page had none. Stable string codes — clients can switch on them. Warnings are stored with the result: async result fetches and cache hits carry them too, filtered to the fields the request asked for."),
424
+ warnings: z.array(z.string()).optional().describe("Non-error notices about the scrape. Truncation codes — `screenshot_truncated` (long page exceeded the scrolling-screenshot height cap), `links_truncated` / `inline_images_truncated` (page had more links/images than the per-page extraction caps), `raw_html_truncated` (rendered HTML exceeded the per-page size budget) — mean the field is present but capped. `elements_truncated` means at least one `elements` value hit a limit: a list was cut at 1,000 matches, the request reached 10,000 matches in total, or a value did not fit the ~1 MB of values allowed per request (that value is then null, never cut short). Unavailability codes — `links_unavailable` / `inline_images_unavailable` / `metadata_unavailable` — mean that optional field could not be extracted and was omitted (null/empty) while the rest of the scrape succeeded, so an empty field carrying one of these does NOT mean the page had none. `screenshot_unavailable` means a screenshot was asked for, but the page came back from the http engine without one. Stable string codes — clients can switch on them. Warnings are stored with the result: async result fetches and cache hits carry them too, filtered to the fields the request asked for. `metadata_truncated` is retired and no longer sent: metadata has no size limit of its own now, though the code can still appear on results stored before that change."),
346
425
  response_meta: Schema_ApiResponseMeta.describe("Request-level metadata. `response_meta.usage` reports what the request cost (total_credit_cost and its parts), the billed engine and the resolved proxy tier.")
347
426
  });
348
427
 
@@ -434,6 +513,9 @@ const DESCRIPTION$5 = [
434
513
  "Fetch a single URL via the crawlbrulee scraping API and return the requested content",
435
514
  "(markdown, cleaned HTML, raw HTML, links, images, screenshot, page metadata in `metadata`).",
436
515
  "Use this for one-shot page extraction. For full-site discovery use the `map` tool first.",
516
+ "To pull named values such as prices, titles or links, set `extract.elements` (name → CSS selector)",
517
+ "instead of reading the whole markdown: they come back in `elements`, for no extra credits.",
518
+ "Rules: https://crawlbrulee.com/docs/scrape/elements.",
437
519
  "Check `page_status_code` before you trust the content: it is the HTTP status the site answered",
438
520
  "with for the final page. A page the site served is a successful result whatever its status, so a",
439
521
  "404 or 503 page comes back with its content, not as an error. A 404 means the markdown is the",
@@ -441,7 +523,8 @@ const DESCRIPTION$5 = [
441
523
  "407, 408, 429 and 451; 5xx pages are never billed.",
442
524
  "If the site cannot be reached at all the tool returns a `target_unreachable` error (HTTP 502,",
443
525
  "not billed): retry later or check the URL.",
444
- "Screenshot URLs in the response are signed download links — the agent can fetch them when needed.",
526
+ "Screenshot URLs in the response are signed download links that expire 24 hours after the scrape:",
527
+ "download the image if you need it later; do not keep the link.",
445
528
  "The response also carries `response_meta.usage`: `total_credit_cost` = `engine_credit_cost` ×",
446
529
  "`proxy_multiplier` + `screenshot_slicing_credit_cost` + `zero_data_retention_credit_cost`, plus `engine` and `proxy` (the resolved",
447
530
  "tier — never `auto`). `engine` is the billed engine (`http`, `browser`, `screenshot`, `cache`); a",
@@ -450,7 +533,7 @@ const DESCRIPTION$5 = [
450
533
  "Extraction is capped per page: 30,000 links, 10,000 inline images and 10,000,000 characters of",
451
534
  "HTML. A page past a cap is truncated rather than refused, and the response `warnings` array names",
452
535
  "which one (`links_truncated`, `inline_images_truncated`, `raw_html_truncated`) — so treat that",
453
- "output as incomplete.",
536
+ "output as incomplete. `elements_truncated` means an `elements` value hit a limit.",
454
537
  "Use `cleanup` to control what is removed before any output is built: `ads_and_popups` (on by",
455
538
  "default) drops ads, cookie banners and chat widgets, and `exclude_selectors` removes anything",
456
539
  "else. It shapes markdown, cleaned_html, links, images and the screenshot, and NEVER `raw_html` —",
@@ -458,7 +541,9 @@ const DESCRIPTION$5 = [
458
541
  "`warnings` also reports a section whose extraction failed outright (`links_unavailable`,",
459
542
  "`inline_images_unavailable`, `metadata_unavailable`): that field comes back omitted or empty",
460
543
  "while the rest of the scrape succeeded, so do NOT conclude the page had no links/images/metadata",
461
- "— re-run the scrape instead. An empty field with no such warning does mean the page had none."
544
+ "— re-run the scrape instead. An empty field with no such warning does mean the page had none.",
545
+ "`screenshot_unavailable` means a screenshot was asked for, but the page came back from the http",
546
+ "engine without one."
462
547
  ].join(" ");
463
548
  function registerScrapeTool(server, getClient) {
464
549
  server.registerTool("scrape", {
@@ -503,6 +588,8 @@ const DESCRIPTION$4 = [
503
588
  "(heavy JS rendering, full-page screenshots of long pages) — for a quick one-shot",
504
589
  "fetch prefer the synchronous `scrape` tool, which blocks and returns the page directly.",
505
590
  "Poll the job with `scrape_status` and fetch the page with `scrape_result` once done.",
591
+ "Takes `extract.elements` like `scrape` (named values by CSS selector, no extra credits); the",
592
+ "result carries them in `elements`. Rules: https://crawlbrulee.com/docs/scrape/elements.",
506
593
  "Optionally attach a per-job completion `webhook`: we deliver a single",
507
594
  "signed `scrape.complete` POST to your endpoint when the job finishes (HTTPS required",
508
595
  "in production), and echoes your opaque `webhook.metadata` back in the delivery",
@@ -523,14 +610,17 @@ function registerScrapeAsyncTool(server, getClient) {
523
610
  const DESCRIPTION$3 = [
524
611
  "Fetch the extracted content of a completed async scrape job (the same result shape as the",
525
612
  "synchronous `scrape` tool: markdown, cleaned HTML, raw HTML, links, images, screenshot,",
526
- "page metadata in `metadata`, and `response_meta.usage`). Errors if the job is still",
527
- "`pending`/`running` — check `scrape_status` first (status `done`) before calling this.",
613
+ "page metadata in `metadata`, values from `extract.elements` in `elements`, and",
614
+ "`response_meta.usage`). Errors if the job is still `pending`/`running` — check",
615
+ "`scrape_status` first (status `done`) before calling this.",
528
616
  "Check `page_status_code` before you trust the content: it is the HTTP status the site answered",
529
617
  "with for the final page. A page the site served is a successful result whatever its status, so a",
530
618
  "404 or 503 page comes back with its content, not as an error. A 404 means the markdown is the",
531
619
  "site's \"not found\" page, not the page you asked for. 2xx and 4xx pages are billed, except 403,",
532
620
  "407, 408, 429 and 451; 5xx pages are never billed.",
533
- "Screenshot URLs are signed download links."
621
+ "A job answers for 24 hours after it was submitted, then returns `not_found`. Screenshot URLs are",
622
+ "signed download links that expire at the same moment, however late you fetch the result: download",
623
+ "the image if you need it later."
534
624
  ].join(" ");
535
625
  function registerScrapeResultTool(server, getClient) {
536
626
  server.registerTool("scrape_result", {
@@ -553,7 +643,8 @@ const DESCRIPTION$2 = [
553
643
  "billed; retry later or check the url. Poll this until the status is",
554
644
  "`done`, then call `scrape_result` to fetch",
555
645
  "the page. If you registered a completion webhook on submit you can skip polling and react",
556
- "to the delivery instead."
646
+ "to the delivery instead. A job answers for 24 hours after it was submitted; after that this",
647
+ "returns `not_found`, the same as for an unknown job id."
557
648
  ].join(" ");
558
649
  function registerScrapeStatusTool(server, getClient) {
559
650
  server.registerTool("scrape_status", {
@@ -618,7 +709,7 @@ function registerWhoamiTool(server, getClient) {
618
709
  //#endregion
619
710
  //#region src/version.ts
620
711
  const SERVER_NAME = "crawlbrulee";
621
- const SERVER_VERSION = "1.2.0";
712
+ const SERVER_VERSION = "1.3.0";
622
713
 
623
714
  //#endregion
624
715
  //#region src/server.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crawlbrulee/mcp",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "mcpName": "io.github.crawlbrulee/mcp",
5
5
  "description": "official mcp server for crawlbrulee — EU-native web scraping for AI agents & developers. native scrape and map tools for your agent.",
6
6
  "keywords": [
@@ -63,7 +63,7 @@
63
63
  "prepublishOnly": "pnpm verify"
64
64
  },
65
65
  "dependencies": {
66
- "@crawlbrulee/sdk": "^1.2.0",
66
+ "@crawlbrulee/sdk": "^1.3.0",
67
67
  "@modelcontextprotocol/sdk": "^1.29.0",
68
68
  "zod": "^4.0.0"
69
69
  },