scorchcrawl-mcp 2.2.0 → 2.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.
- package/dist/index.js +0 -69
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -622,75 +622,6 @@ Check the status of a crawl job.
|
|
|
622
622
|
}, { tool: 'scorch_check_crawl_status' });
|
|
623
623
|
},
|
|
624
624
|
});
|
|
625
|
-
server.addTool({
|
|
626
|
-
name: 'scorch_extract',
|
|
627
|
-
description: `
|
|
628
|
-
Extract structured information from web pages using LLM capabilities. Supports both cloud AI and self-hosted LLM extraction.
|
|
629
|
-
|
|
630
|
-
**Best for:** Extracting specific structured data like prices, names, details from web pages.
|
|
631
|
-
**Not recommended for:** When you need the full content of a page (use scrape); when you're not looking for specific structured data.
|
|
632
|
-
**Arguments:**
|
|
633
|
-
- urls: Array of URLs to extract information from
|
|
634
|
-
- prompt: Custom prompt for the LLM extraction
|
|
635
|
-
- schema: JSON schema for structured data extraction
|
|
636
|
-
- allowExternalLinks: Allow extraction from external links
|
|
637
|
-
- enableWebSearch: Enable web search for additional context
|
|
638
|
-
- includeSubdomains: Include subdomains in extraction
|
|
639
|
-
**Prompt Example:** "Extract the product name, price, and description from these product pages."
|
|
640
|
-
**Usage Example:**
|
|
641
|
-
\`\`\`json
|
|
642
|
-
{
|
|
643
|
-
"name": "scorch_extract",
|
|
644
|
-
"arguments": {
|
|
645
|
-
"urls": ["https://example.com/page1", "https://example.com/page2"],
|
|
646
|
-
"prompt": "Extract product information including name, price, and description",
|
|
647
|
-
"schema": {
|
|
648
|
-
"type": "object",
|
|
649
|
-
"properties": {
|
|
650
|
-
"name": { "type": "string" },
|
|
651
|
-
"price": { "type": "number" },
|
|
652
|
-
"description": { "type": "string" }
|
|
653
|
-
},
|
|
654
|
-
"required": ["name", "price"]
|
|
655
|
-
},
|
|
656
|
-
"allowExternalLinks": false,
|
|
657
|
-
"enableWebSearch": false,
|
|
658
|
-
"includeSubdomains": false
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
\`\`\`
|
|
662
|
-
**Returns:** Extracted structured data as defined by your schema.
|
|
663
|
-
`,
|
|
664
|
-
parameters: z.object({
|
|
665
|
-
urls: z.array(z.string()),
|
|
666
|
-
prompt: z.string().optional(),
|
|
667
|
-
schema: z.record(z.string(), z.any()).optional(),
|
|
668
|
-
allowExternalLinks: z.boolean().optional(),
|
|
669
|
-
enableWebSearch: z.boolean().optional(),
|
|
670
|
-
includeSubdomains: z.boolean().optional(),
|
|
671
|
-
}),
|
|
672
|
-
execute: async (args, { session, log }) => {
|
|
673
|
-
const a = args;
|
|
674
|
-
return safeExecute(async () => {
|
|
675
|
-
const client = getClient(session);
|
|
676
|
-
log.info('Extracting from URLs', {
|
|
677
|
-
count: Array.isArray(a.urls) ? a.urls.length : 0,
|
|
678
|
-
});
|
|
679
|
-
const extractBody = removeEmptyTopLevel({
|
|
680
|
-
urls: a.urls,
|
|
681
|
-
prompt: a.prompt,
|
|
682
|
-
schema: a.schema || undefined,
|
|
683
|
-
allowExternalLinks: a.allowExternalLinks,
|
|
684
|
-
enableWebSearch: a.enableWebSearch,
|
|
685
|
-
includeSubdomains: a.includeSubdomains,
|
|
686
|
-
origin: ORIGIN,
|
|
687
|
-
});
|
|
688
|
-
const res = await client.extract(extractBody);
|
|
689
|
-
// Extract returns structured data — skip summarization
|
|
690
|
-
return await processResponse(res, { skipSummarization: true });
|
|
691
|
-
}, { tool: 'scorch_extract' });
|
|
692
|
-
},
|
|
693
|
-
});
|
|
694
625
|
const PORT = Number(process.env.PORT || 3000);
|
|
695
626
|
const HOST = process.env.CLOUD_SERVICE === 'true'
|
|
696
627
|
? '0.0.0.0'
|