---
title: "CLI"
description: "The web command, its subcommands, the flags, and the JSON envelopes that match the library."
canonical_url: "https://web.agntn.dev/guide/cli"
---
# CLI

> The web command, its subcommands, the flags, and the JSON envelopes that match the library.

## Run it

```bash
pnpm add -g @agntn/web
web "your query"
```

`web <query>` searches with the first configured provider. The subcommands do the rest:

| Command | Description |
| --- | --- |
| `web <query>` | Search the web using the default provider |
| `web search <query...>` | Search one or more queries |
| `web search-image <url>` | Find matching pages from a public image URL, also as `image-search` |
| `web read <url...>` | Read one or more URLs into normalized content |
| `web reveal <url>` | List what a page hides: comments, hidden fields, invisible text |
| `web providers` | List registered providers and their capabilities |
| `web mcp` | Run the MCP server over stdio |

## Examples

```bash
web --provider brave "your query" --max-results 5
web search "your query" --json
web search "first query" "second query" --provider all --json
web search "your query" --provider firecrawl --sources '["web","news"]' --categories '["research"]'
web search "your query" --provider exa --summary --full-text
web search "your query" --provider brave --continuation <opaque-token> --json
web search "your query" --include-domains '["github.com","stackoverflow.com"]' --start-published-date 2026-01-01
web search-image https://example.com/image.jpg --max-results 5 --json
web read https://example.com --format markdown --max-chars 20000 --json
web read https://example.com --max-chars 20000 --continuation <opaque-token> --json
web read https://example.com/one https://example.com/two --json
web read https://example.com --provider firecrawl --no-cache
web providers --json
```

## Flags

| Flag | Description |
| --- | --- |
| `--provider <name>` | Provider to use (text: first configured or `all`; image: SerpAPI; read: auto starting with Jina) |
| `--max-results <n>` | Maximum text or image results (default: `10`) |
| `--no-highlights` | Disable the passages picked for the query when supported |
| `--summary` | Request generated summaries from Exa or an answer from Tavily |
| `--full-text` | Request full page text from Exa or Tavily |
| `--include-domains <json>` | Include only these domains in text search |
| `--exclude-domains <json>` | Exclude these domains from text search |
| `--sources <json>` | Source types for providers that support them |
| `--categories <json>` | Categories for providers that support them |
| `--category <name>` | One provider category |
| `--start-published-date <ISO date>` | Earliest publication date |
| `--end-published-date <ISO date>` | Latest publication date |
| `--favicon` | Keep the favicon URL on each search result |
| `--timeout-seconds <n>` | Give up after this many seconds, keeping what a batch or fan-out finished |
| `--format <markdown\|text\|html>` | Preferred read format |
| `--max-tokens <n>` | Jina's token budget, a longer page fails instead of being cut |
| `--max-chars <n>` | Portable maximum of page content characters |
| `--continuation <token>` | Continue a search page or a truncated read of one URL |
| `--links` | Keep the page's links in a read bounded by `--max-chars` |
| `--images` | Keep the page's image URLs in a read bounded by `--max-chars` |
| `--target-selector <css>` | Read only this part of the page, where the reader supports it |
| `--remove-selector <css>` | Drop this part of the page, where the reader supports it |
| `--timeout <s>` | The reader's own timeout, where it has one |
| `--no-cache` | Ask the reader for a fresh copy instead of its cached one, where the provider allows it |
| `--json` | Print the data instead of the text |

Lists are JSON arrays. More quotes than commas, sure. But it's the array the agent tools take. Nothing gets split in a weird place. Read commands pick the reader unless `--provider` is set. `web read` prints the whole page, `--max-chars` cuts it.

Lost a flag? `web <command> --help` lists them straight from the schema MCP, Pi and OMP get. The CLI can't quietly fall behind the tools.

## Text and JSON

Without `--json` you get the text a model gets. A header with the provider, numbered results, then continuations and warnings. Handy when you wonder why an agent picked the link it did.

`--json` prints the data under `result`, the same object MCP sends as `structuredContent`. One parser for every surface, that was the point.

- A single search has `result: { provider, results, ignoredFilters, undeclaredFilters, pagination, metadata? }`, plus `attempts` and `failures` when the provider was picked automatically.
- `--provider all` has `result: { results, successfulProviders, errors, filterReports, providerPagination, providerMetadata? }`, with `providers` and `evidence` on every result. Provider errors are part of the output, not a reason to exit.
- A batch of queries has one item per query in `result`, each with its own result or error.
- A single read has `result: { result, requestedProvider, provider, attempts, failures }`. A batch adds `url` to each success and keeps the same diagnostics on each exhausted failure. Any failed read item makes the command exit 1, but the successes are still printed.

A failure that ends the command prints one line on stderr and exits 1, whether it's a spent key, a bad token or a date that isn't ISO 8601. Nothing lands on stdout, `--json` included. A flag the command doesn't take ends it the same way. The error lists the ones it does take. `web read <url> --no-cahce` names the typo and reads nothing, instead of quietly answering from the cache. `web mcp` is the one that lets it slide, so a stray flag in a client config doesn't take the server down.

## MCP

```bash
web mcp
```

starts a [Model Context Protocol](https://modelcontextprotocol.io) server over stdio with `web_search`, `web_image_search`, `web_read`, `web_reveal` and `web_providers`. Register it with any client:

```bash
claude mcp add web --scope user -- web mcp
```

[Agents](https://web.agntn.dev/guide/agents) covers what the tools accept and return.


## Sitemap

See the full [sitemap](https://web.agntn.dev/sitemap.md) for all pages.
