Skip to content

Commit 05e1dab

Browse files
feat(api): api update
1 parent ddcb928 commit 05e1dab

4 files changed

Lines changed: 22 additions & 6 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 21
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-86caee6743259bcab1e72868d17acdfc8a515d51b6d9b1e9a1dca49cdd3bd8da.yml
3-
openapi_spec_hash: c0855025a8590139f57db43dd3e1bad1
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev%2Fcontext.dev-955fa0d672331fb3f8b40547895bfdd1e490add254ca13db769289d3bef2ed44.yml
3+
openapi_spec_hash: 32eca3166fb8f369c9241faf4cee3077
44
config_hash: 682b89b02a20f5d1c13e2c91ecbcf5ce

packages/mcp-server/src/local-docs-search.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ const EMBEDDED_METHODS: MethodEntry[] = [
5858
description: 'Scrapes the given URL and returns the raw HTML content of the page.',
5959
stainlessPath: '(resource) web > (method) web_scrape_html',
6060
qualified: 'client.web.webScrapeHTML',
61-
params: ['url: string;'],
61+
params: ['url: string;', 'maxAgeMs?: number;'],
6262
response: '{ html: string; success: true; url: string; }',
6363
markdown:
64-
"## web_scrape_html\n\n`client.web.webScrapeHTML(url: string): { html: string; success: true; url: string; }`\n\n**get** `/web/scrape/html`\n\nScrapes the given URL and returns the raw HTML content of the page.\n\n### Parameters\n\n- `url: string`\n Full URL to scrape (must include http:// or https:// protocol)\n\n### Returns\n\n- `{ html: string; success: true; url: string; }`\n\n - `html: string`\n - `success: true`\n - `url: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.web.webScrapeHTML({ url: 'https://example.com' });\n\nconsole.log(response);\n```",
64+
"## web_scrape_html\n\n`client.web.webScrapeHTML(url: string, maxAgeMs?: number): { html: string; success: true; url: string; }`\n\n**get** `/web/scrape/html`\n\nScrapes the given URL and returns the raw HTML content of the page.\n\n### Parameters\n\n- `url: string`\n Full URL to scrape (must include http:// or https:// protocol)\n\n- `maxAgeMs?: number`\n Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Set to 0 to always scrape fresh.\n\n### Returns\n\n- `{ html: string; success: true; url: string; }`\n\n - `html: string`\n - `success: true`\n - `url: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.web.webScrapeHTML({ url: 'https://example.com' });\n\nconsole.log(response);\n```",
6565
perLanguage: {
6666
http: {
6767
example:
@@ -96,12 +96,13 @@ const EMBEDDED_METHODS: MethodEntry[] = [
9696
'url: string;',
9797
'includeImages?: boolean;',
9898
'includeLinks?: boolean;',
99+
'maxAgeMs?: number;',
99100
'shortenBase64Images?: boolean;',
100101
'useMainContentOnly?: boolean;',
101102
],
102103
response: '{ markdown: string; success: true; url: string; }',
103104
markdown:
104-
"## web_scrape_md\n\n`client.web.webScrapeMd(url: string, includeImages?: boolean, includeLinks?: boolean, shortenBase64Images?: boolean, useMainContentOnly?: boolean): { markdown: string; success: true; url: string; }`\n\n**get** `/web/scrape/markdown`\n\nScrapes the given URL, converts the HTML content to Markdown, and returns the result.\n\n### Parameters\n\n- `url: string`\n Full URL to scrape and convert to markdown (must include http:// or https:// protocol)\n\n- `includeImages?: boolean`\n Include image references in Markdown output\n\n- `includeLinks?: boolean`\n Preserve hyperlinks in Markdown output\n\n- `shortenBase64Images?: boolean`\n Shorten base64-encoded image data in the Markdown output\n\n- `useMainContentOnly?: boolean`\n Extract only the main content of the page, excluding headers, footers, sidebars, and navigation\n\n### Returns\n\n- `{ markdown: string; success: true; url: string; }`\n\n - `markdown: string`\n - `success: true`\n - `url: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.web.webScrapeMd({ url: 'https://example.com' });\n\nconsole.log(response);\n```",
105+
"## web_scrape_md\n\n`client.web.webScrapeMd(url: string, includeImages?: boolean, includeLinks?: boolean, maxAgeMs?: number, shortenBase64Images?: boolean, useMainContentOnly?: boolean): { markdown: string; success: true; url: string; }`\n\n**get** `/web/scrape/markdown`\n\nScrapes the given URL, converts the HTML content to Markdown, and returns the result.\n\n### Parameters\n\n- `url: string`\n Full URL to scrape and convert to markdown (must include http:// or https:// protocol)\n\n- `includeImages?: boolean`\n Include image references in Markdown output\n\n- `includeLinks?: boolean`\n Preserve hyperlinks in Markdown output\n\n- `maxAgeMs?: number`\n Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Set to 0 to always scrape fresh.\n\n- `shortenBase64Images?: boolean`\n Shorten base64-encoded image data in the Markdown output\n\n- `useMainContentOnly?: boolean`\n Extract only the main content of the page, excluding headers, footers, sidebars, and navigation\n\n### Returns\n\n- `{ markdown: string; success: true; url: string; }`\n\n - `markdown: string`\n - `success: true`\n - `url: string`\n\n### Example\n\n```typescript\nimport ContextDev from 'context.dev';\n\nconst client = new ContextDev();\n\nconst response = await client.web.webScrapeMd({ url: 'https://example.com' });\n\nconsole.log(response);\n```",
105106
perLanguage: {
106107
http: {
107108
example:

src/resources/web.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,13 @@ export interface WebWebScrapeHTMLParams {
383383
* Full URL to scrape (must include http:// or https:// protocol)
384384
*/
385385
url: string;
386+
387+
/**
388+
* Return a cached result if a prior scrape for the same parameters exists and is
389+
* younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
390+
* omitted. Set to 0 to always scrape fresh.
391+
*/
392+
maxAgeMs?: number;
386393
}
387394

388395
export interface WebWebScrapeImagesParams {
@@ -409,6 +416,13 @@ export interface WebWebScrapeMdParams {
409416
*/
410417
includeLinks?: boolean;
411418

419+
/**
420+
* Return a cached result if a prior scrape for the same parameters exists and is
421+
* younger than this many milliseconds. Defaults to 1 day (86400000 ms) when
422+
* omitted. Set to 0 to always scrape fresh.
423+
*/
424+
maxAgeMs?: number;
425+
412426
/**
413427
* Shorten base64-encoded image data in the Markdown output
414428
*/

tests/api-resources/web.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ describe('resource web', () => {
7878

7979
// Mock server tests are disabled
8080
test.skip('webScrapeHTML: required and optional params', async () => {
81-
const response = await client.web.webScrapeHTML({ url: 'https://example.com' });
81+
const response = await client.web.webScrapeHTML({ url: 'https://example.com', maxAgeMs: 0 });
8282
});
8383

8484
// Mock server tests are disabled
@@ -116,6 +116,7 @@ describe('resource web', () => {
116116
url: 'https://example.com',
117117
includeImages: true,
118118
includeLinks: true,
119+
maxAgeMs: 0,
119120
shortenBase64Images: true,
120121
useMainContentOnly: true,
121122
});

0 commit comments

Comments
 (0)