> ## Documentation Index
> Fetch the complete documentation index at: https://agentheya.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# web_fetch

> Fetch the content of a URL and return it as clean markdown.

# web\_fetch

Fetches the content of a single URL and returns it as clean markdown. Use to read a specific page (article, doc, blog post) — usually after `web_search` has surfaced a URL worth examining.

## Parameters

| Name        | Type           | Required | Description                                                           |
| ----------- | -------------- | -------- | --------------------------------------------------------------------- |
| `url`       | string (url)   | yes      | The full `http(s)` URL to fetch.                                      |
| `max_chars` | integer (≥500) | no       | Max characters of markdown to return. Default 50000 (\~12.5k tokens). |

## Returns

A formatted markdown payload with the page contents. On failure:

```json theme={null}
{
  "error": "web_fetch failed: ...",
  "details": {
    "url": "https://example.com/...",
    "http_status": 403,
    "hint": "..."
  }
}
```

## Call from your own custom tool

```js theme={null}
export async function handle(input, ctx) {
  const page = await ctx.tools.web_fetch({
    url: input.article_url,
    max_chars: 8000,
  });
  return { page };
}
```

```python theme={null}
async def handle(input, ctx):
    page = await ctx.tools.web_fetch({
        'url': input['article_url'],
        'max_chars': 8000,
    })
    return { 'page': page }
```

## Notes

* Pages behind paywalls, robot blocks, or that error upstream will return an error envelope.
