mcp-server-typescript icon indicating copy to clipboard operation
mcp-server-typescript copied to clipboard

Your input exceeds the context window of this model. Please adjust your input and try again.

Open 62316e opened this issue 1 year ago • 6 comments

Hi,

First of all: nice tool.

The problem is that JSON returned from those tools are way too big. I'm always getting "Your input exceeds the context window of this model. Please adjust your input and try again.". I'm using gpt-5-mini (Input: 272,000 Output: 128,000).

Any solution to this?

62316e avatar Aug 27 '25 20:08 62316e

Hi You can improve the situation by specifying the “limit” field to restrict unnecessary data elements in the response, or switch the model to prompts that will use our mcp tools, and then switch back to continue the conversation.

lVics avatar Aug 28 '25 09:08 lVics

Thanks for prompt response. Limit does not solve the problem. DATAFORSEO_FULL_RESPONSE does not help as well.

For example: Call: https://api.dataforseo.com/v3/on_page/lighthouse/live/json.ai Response size: 639494

This is way too much information. Another problem is that Open AI models having troubles analyzing a lot of data in one go.

Would be nice to have output format option eg Markdown vs JSON.

62316e avatar Aug 28 '25 13:08 62316e

I'm also having major issues with the context window blowout being caused by this MCP server. It needs much better context disclosure architecture. I work with many MCP servers that have a lot more capabilities than this one which manage context just fine.

jason-dark avatar Mar 15 '26 21:03 jason-dark

Hi @62316e,

This was fixed in the latest version. The Lighthouse tool now returns a much shorter response to avoid exceeding the model context window.

Please update to the latest version and it should work without hitting the limit.

dfsvlado avatar Mar 16 '26 08:03 dfsvlado

Hello @jason-dark!

Thanks for the feedback.

Could you specify which APIs or endpoints are causing the context window issue on your side? That would help us better understand where the large responses are coming from and improve them.

dfsvlado avatar Mar 16 '26 08:03 dfsvlado

Hi @dfsvlado, answering your question from March with concrete measurements (Claude Code 2.1.283, dataforseo-mcp-server 3.1.1, September 2026):

  1. The biggest offender for us was keywords_data/google_ads/keywords_for_keywords/live. It has no limit parameter, and a single call returned about 13.6 MB. Claude Code disconnects a stdio MCP server once more than 16 MB go through stdout at once (log: "wrote >16MB to stdout … Disconnecting"). Two such calls in parallel killed the connection for the rest of the session.
  2. dataforseo_labs/google/keyword_ideas/live returns up to 700 items per page by default, which we estimate at about 2.9 MB. With limit: 20 plus filters the response was 82 KB, so limit works well there.
  3. The .ai format helps with size, but it does not include the cost field. A SERP call still cost 0.002 USD, visible only through the account balance. It also caps depth and limit at 10 unless you set them. We use noAiMode: true whenever we need cost evidence and set limits ourselves.

What worked for us: always pass limit and filters, call endpoints one after another instead of in parallel, and use Labs keyword_ideas instead of keywords_for_keywords for idea generation. A default limit or size guard for keywords_for_keywords on the server side would probably prevent most of these blowouts.

If that direction sounds good to you, we would be happy to open a small PR for such a size guard. Just let us know what you would prefer.

Hope this helps!

Brandea-ai avatar Sep 26 '26 14:09 Brandea-ai