web-tools

Public

Forked from npacker/web-tools

A web tools plugin for LM Studio built on the impit client for improved bot detection evasion. Includes a Visit Website tool and Web Search backed by DuckDuckGo.

217 Downloads

README

Web Tools Plugin for LM Studio

An LM Studio plugin that gives local LLMs four web-oriented capabilities: searching the web, searching for images, visiting a page and reading its content, and downloading images into the chat's working directory so the assistant can embed them inline.

Key features

  • Bot-resistant requests — outbound requests use impit, which applies real-browser TLS fingerprints and request headers for improved bot-detection evasion without the weight or security surface of a full browser stack.
  • SSRF protection — every outbound URL is validated by dssrf before the request is issued, rejecting non-HTTP schemes, malformed URLs, and addresses that resolve to private or reserved IP ranges. A randomized double DNS resolution mitigates DNS rebinding.
  • Resilient request pipeline — all requests are cached, rate-limited, and retried with randomized exponential backoff.
  • Hard payload caps — separate per-image and per-page byte limits keep memory exposure bounded when fetching arbitrarily large remote content.
  • Search result enrichment — search results optionally run through metascraper to surface publication date, type, and description, providing useful detail without needing to load the full page into context.
  • Intelligent content extraction — Visit Website routes HTML through @mozilla/readability, stripping navigation, sidebars, and ads, so the model only sees relevant content.
  • Markdown or plain-text rendering — HTML content can be converted to Markdown, or stripped to plain text for token efficiency. PDFs are transparently converted to Markdown.
  • Content fuzzy matching — when a page is larger than the configured content length, relevant content is sliced and returned based on fuzzy-matched search terms, letting context-constrained models extract useful information from long pages.

Tools

Runs a query-string search against DuckDuckGo and returns relevant results.

ParameterTypeNotes
querystringRequired.
pageint 1–100Optional. Defaults to 1. Enables pagination.

Returns an array of records:

FieldTypeNotes
titlestring
urlstring
snippetstringOmitted when Web Search: Include Result Snippets is off.
datestringPublication or modification date. Omitted when unavailable or enrichment is off.
typestringOpenGraph og:type. Omitted when unavailable or enrichment is off.
descriptionstringPage meta description, ~500 char max. Omitted when unavailable or enrichment is off.

Runs a query-string search against Bing's image index and returns candidate image URLs along with the source page.

ParameterTypeNotes
querystringRequired.
pageint 1–100Optional. Defaults to 1.

Returns an array of records:

FieldTypeNotes
imagestringFull-resolution remote URL.
titlestringOmitted when unavailable.
sourcePagestringPage hosting the image. Omitted when unavailable.

Visit Website

Fetches a URL and returns its title, top-level headings, and a readable-content excerpt. Handles HTML pages and PDFs (and surfaces plain-text and JSON responses too). Content is returned as Markdown by default, with plain text as an option.

When a page is longer than the configured character budget, the Assistant has the option to refine the returned content by an array of search terms.

ParameterTypeNotes
urlURLRequired.
findInPagestring[]Optional. Biases content slices on pages exceeding the character budget.

Returns a single record:

FieldTypeNotes
urlstringEchoed input URL.
kindstringOne of html, pdf, text, or json.
mimeTypestringServer-reported or sniffed MIME type.
titlestringOmitted when unavailable.
h1stringFirst <h1>. Omitted when absent or non-HTML.
h2stringFirst <h2>. Omitted when absent or non-HTML.
contentstringExcerpt, truncated to the configured character budget.
contentLengthnumberThe length of the page content before any truncation.

Fetch Images

Downloads images into the chat's working directory and returns a Markdown reference so the assistant can embed them inline. Inputs are HTTP(S) URLs picked from Image Search, discovered in a Visit Website excerpt, or scraped automatically from a page when websiteURL is supplied.

ParameterTypeNotes
imageURLsURL[]Optional. Explicit list of HTTP(S) URLs to download.
websiteURLURLOptional. Page to scrape for <img> tags.
maxImagesint 1–200Optional. Overrides the scraped-image cap when websiteURL is supplied.

Returns an array of records:

FieldTypeNotes
filenamestringDerived from the URL.
altstring<img> alt text when scraped via websiteURL. Empty for explicit imageURLs.
titlestring<img> title attribute when scraped via websiteURL. Empty for explicit imageURLs.
imagestringMarkdown image reference (![alt](localPath)). Present on success.
errorstringFailure message, in place of image on download failure.

Installation

From the LM Studio Hub

Install via the LM Studio CLI:

lms get npacker/web-tools

Or browse to the plugin on the LM Studio Hub and click "Run in LM Studio." Once enabled, the included tools become available to any model that supports tool calls.

Usage

With the plugin enabled you can explicitly ask the assistant to search the web, search for images, visit a page, or fetch images, but you can also just ask a question whose answer requires the web and the assistant will pick the right tool on its own. Image displays follow the natural pipeline: Image Search surfaces candidate URLs, Fetch Images downloads the picks into the chat's working directory, and the assistant embeds the returned Markdown references in its reply.

Configuration

All fields are exposed in the LM Studio plugin UI.

General

FieldRangeDefaultPurpose
Browser FingerprintFirefox (latest) / Firefox 144 / Chrome (latest) / Chrome 131Firefox (latest)TLS and header fingerprint for outbound requests.
Safe Searchstrict / moderate / off / AutoAuto → moderateSafe-search mode for web and image search.
FieldRangeDefaultPurpose
Web Search: Include Result Snippetson/offonInclude preview snippet alongside title and URL.
Web Search: Enrich Resultson/offonFetch each result page to extract date, OpenGraph type, and description.
Web Search: Limit Resultson/offonOff includes every result on the page (≈30).
Web Search: Max Results1–3010Cap when limiting is on.
FieldRangeDefaultPurpose
Image Search: Limit Resultson/offonOff includes every image on the page (≈35).
Image Search: Max Results1–3510Cap when limiting is on. Max of 35 (Bing's page size).

Visit Website

FieldRangeDefaultPurpose
Visit Website: Content FormatMarkdown / Plain textMarkdownOutput format for the content field.
Visit Website: Content Character Limit1000–100 00010 000Character budget for the page excerpt.
Visit Website: Max Response Size (MB)1–1005Caps HTML payload (Visit Website and Fetch Images websiteURL scraping).

Fetch Images

FieldRangeDefaultPurpose
Fetch Images: Max Images1–20010Max images scraped from websiteURL. Overridable via maxImages.
Max Image Size (MB)1–10010Caps per-image download size.

Cache TTLs

FieldRangeDefaultPurpose
Search Cache TTL (s)0–3600900 (15 min)Web-search payload cache lifetime. 0 disables.
Website Cache TTL (s)0–3600600 (10 min)HTML cache lifetime. Shared by Visit Website, Fetch Images, and Web Search enrichment. 0 disables.

Request pacing and retry

FieldRangeDefaultPurpose
Min Interval Between Requests (s)0–305Minimum gap between outbound HTTP requests. 0 disables.
Max Retries Per Request0–42Retry attempts after the first try. 0 disables.
Retry Initial Backoff (s)0–301Base backoff before the first retry.
Retry Max Backoff (s)0–30030Upper bound on backoff delay.

Caching

Two disk-backed cacache stores, persisted under ~/.lmstudio/plugin-data/lms-plugin-duckduckgo-cache/:

  • Web-search results — up to 100 entries, default TTL 15 minutes (searchCacheTtlSeconds). Stores the post-enrichment payload, so warm queries skip both the DuckDuckGo fetch and enrichment.
  • Website HTML — up to 50 entries, default TTL 10 minutes (websiteCacheTtlSeconds). Shared by Visit Website, Fetch Images, and the Web Search enrichment pass.

Image search is not cached — Bing's response is small and the rate limiter alone caps fetch rate.

Caches survive plugin reloads. To fully clear them, stop LM Studio and delete the cache directory above.

Rate limiting and retry

A shared bottleneck-backed rate limiter enforces a minimum gap between outbound requests for single-target requests (Web Search, Image Search, Visit Website, Fetch Images). Web Search enrichment uses a per-host limiter, so requests to distinct domains run in parallel.

Every outbound request is wrapped by p-retry with randomized exponential backoff.

Local development

git clone https://github.com/packern/web-tools.git
cd web-tools
npm install
npm run dev    # runs `lms dev`

npm run push publishes the plugin to the LM Studio Hub (lms push).

Credits

Built on top of Daniel Sig's original lms-plugin-duckduckgo and lms-plugin-visit-website plugins, now merged into a single tool suite, Markdown-formatted website content, fuzzy-matching for content slicing, configurable rate limiting and retry, and a persistent cache for web-search results and fetched HTML.

License

MIT — see LICENSE.