Skip to main content
Keep a long page from taking over your agent’s context. Cap content with max_chars, read truncated and total_chars to see how much was left out, and ask a prompt for the part you need when the page is longer than your budget.

Parameters

Without max_chars, a fetch returns up to 50,000 characters of content. Over MCP, fetch_page_content returns up to 20,000 unless you set max_chars.

Cap a page, then extract

This sample reads the first 2,000 characters of the Python 3.13 release notes, prints whether the page was cut and how long it is, and then asks a prompt for one list from the whole page. It runs with no API key:
You see that the page is 191,381 characters long, so the first call kept about 1% of it. The second call returns only the list of PEP 594 removals. This run was made on 19 November 2026, and the Python output is shown:
Example output · results vary

Read what was cut

These fields of the fetch response tell your code whether it has the whole page: Lengths count Unicode code points, not bytes or tokens. With a prompt, all three describe the model’s answer instead of the page.

Choose a strategy

Fetch always cuts from the end: max_chars keeps the start of the page, and there is no parameter to start reading later in the page. To reach text near the end of a long page, use a prompt or a URL closer to that text.

Common mistakes

In the SDKs, CLI and MCP

Every SDK returns truncated and total_chars on the page it fetches: page.truncated and page.total_chars in Python and Rust, page.truncated and page.totalChars in TypeScript (from keenable 0.2.0), Truncated and TotalChars in Go. The CLI takes --max-chars and prints both fields (see CLI). Over MCP, fetch_page_content adds a line such as Truncated: showing the first 2000 of 191381 characters when it cuts a page (see MCP server).

API reference