README.md
A single-tool LM Studio plugin that gives the AI model one-call internet research.
The model calls deep_search with a query string and gets back a formatted, token-safe report — no chaining required.
| Phase | What happens |
|---|---|
| 1 – Search | Queries DuckDuckGo HTML endpoint. If DNS / network fails, automatically falls back to Google. |
| 2 – Scrape | Visits each of the top N result URLs in parallel using axios + cheerio. Strips scripts, styles, navbars, footers, cookie banners, ads. Extracts clean prose from <article> / <main> / <body>. |
| 3 – Report | Combines all extracts into one formatted Markdown string, hard-capped at 4 000 characters to protect the model's context window. |
| Problem | Fix |
|---|---|
getaddrinfo ENOTFOUND (DNS failures) | dns.setServers(['8.8.8.8', '8.8.4.4']) applied at module load; DuckDuckGo → Google fallback. |
| Fetch blocked by target sites | axios with 19-entry User-Agent rotation + proper Referer/Sec-Fetch-* headers. |
| Raw HTML flooding context | cheerio removes all non-content nodes before extracting text. |
| Context window overflow | Per-site char limit + hard global cap of 4 000 chars. |
| Two tools confusing the model | One tool only: deep_search. |
| Setting | Default | Description |
|---|---|---|
| URLs to Scrape | 3 | How many top search results to visit (1–5) |
| Max Chars Per Site | 1200 | Character limit per scraped page |
| Safe Search | auto | Strict / Moderate / Off / Auto |
| Package | Purpose |
|---|---|
@lmstudio/sdk | LM Studio plugin API |
axios | Reliable HTTP with gzip, redirect handling, DNS respect |
cheerio | Fast server-side HTML parsing and content extraction |
zod | Parameter schema validation |
npm install
lms dev # local development / hot-reload
lms push # deploy to LM Studio
Tool name: deep_search
Parameters:
query string (required) The research question
numResults int 1-5 (optional) Override URLs-to-scrape setting
safeSearch enum (optional) "strict" | "moderate" | "off"