wclin's profile picture
wclin

deep-search

Public

Forked from vonguyendangkhoi/deep-search

187 Downloads

README

lms-plugin-deep-search

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.


What it does (3-phase pipeline)

PhaseWhat happens
1 – SearchQueries DuckDuckGo HTML endpoint. If DNS / network fails, automatically falls back to Google.
2 – ScrapeVisits 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 – ReportCombines all extracts into one formatted Markdown string, hard-capped at 4 000 characters to protect the model's context window.

Critical fixes over the original plugins

ProblemFix
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 sitesaxios with 19-entry User-Agent rotation + proper Referer/Sec-Fetch-* headers.
Raw HTML flooding contextcheerio removes all non-content nodes before extracting text.
Context window overflowPer-site char limit + hard global cap of 4 000 chars.
Two tools confusing the modelOne tool only: deep_search.

Installation

npm install
lms dev       # local development / hot-reload
lms push      # deploy to LM Studio

Plugin settings (LM Studio UI)

SettingDefaultDescription
URLs to Scrape3How many top search results to visit (1–5)
Max Chars Per Site1200Character limit per scraped page
Safe SearchautoStrict / Moderate / Off / Auto

Tool schema

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"

Dependencies

PackagePurpose
@lmstudio/sdkLM Studio plugin API
axiosReliable HTTP with gzip, redirect handling, DNS respect
cheerioFast server-side HTML parsing and content extraction
zodParameter schema validation