---
title: "MCP tool response too large: how to fix it"
description: Big MCP tool results get cut, saved to a file or crowd out the context. Fix it with limits and filters in the tool, MAX_MCP_OUTPUT_TOKENS, or a cap at the gateway.
canonical: https://mcp1.com/blog/mcp-tool-response-too-large
last-updated: 2026-12-02
---

# MCP tool response too large: how to fix it

Big MCP tool results get cut, saved to a file or crowd out the context. Fix it with limits and filters in the tool, MAX\_MCP\_OUTPUT\_TOKENS, or a cap at the gateway.

![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite

 tools/call

vercel\_\_get\_runtime\_logs3,412 KB

limit: 50, level: "error", since: "1h"6 KB

 tools/call

vercel\_\_get\_runtime\_logs3,412 KB

limit: 50, level: "error", since: "1h"6 KB

When an MCP tool response is too large, the client either cuts it, saves it to a file or fills the context window with it, and the model answers worse in every case. The lasting fix is on the server side: tools that filter, page and summarize by default. Until then, ask for less in the prompt, and in Claude Code raise `MAX_MCP_OUTPUT_TOKENS` only when you really need the whole result.

## Why are big MCP responses a problem?

Everything a tool returns goes into the model’s context and stays there for the rest of the conversation. A 2 MB log dump costs tokens on every later turn, pushes out the instructions and code the model was working from, and hides the three lines that mattered among thousands that didn’t. A tool that returns the right 50 lines gives a better answer than one that returns everything, even when everything fits.

## What does Claude Code do with a large MCP result?

Claude Code has several limits, and they apply at different sizes:

LimitWhat happens

10,000 tokens

A warning in the transcript. Fixed, not configurable.

50,000 characters

A successful text result is saved to a file in the session’s tool-results directory, and the conversation gets the file path instead.

`MAX_MCP_OUTPUT_TOKENS`

Default 25,000 tokens. Past it, the result is saved to a file the same way.

Error results

Error text past about 11,000 characters keeps its first and last 5,000 characters.

16 MiB

An HTTP or SSE response this big fails outright.

Raise the token limit for one session when a tool’s full output is the point, such as a long file or a schema dump:

Terminal

```
export MAX_MCP_OUTPUT_TOKENS=50000
claude
```

The 50,000-character threshold doesn’t move with this variable. A server author can raise it for a single tool by declaring `anthropic/maxResultSizeChars` in the tool’s `_meta`, up to a ceiling of 500,000 characters:

tools/list entry

```
{
  "name": "get_file",
  "description": "Returns a whole source file.",
  "inputSchema": { "type": "object", "properties": { "path": { "type": "string" } } },
  "_meta": { "anthropic/maxResultSizeChars": 200000 }
}
```

Both are escape hatches. If you raise them for every session, you pay for the big answers in tokens and in answer quality.

## How do I make an MCP tool return less?

Design the tool so the small answer is the default and the big one takes a deliberate call. MCP’s pagination covers list operations like `tools/list`, not `tools/call`, so a tool that pages its results defines its own parameters. What works:

1. 1A `limit` with a small default and a hard maximum. The model asks for more when it needs more.
2. 2Filters that match how people ask: a time range, a level or status, a search string. Vercel’s `get_runtime_logs` defaults to a short recent window for this reason.
3. 3A `cursor` for the next page, with a line in the answer that says how many results are left and how to get them.
4. 4Trimmed fields. Return the columns a person would read, cut long messages, and leave out raw payloads unless asked.
5. 5Counts and groups before rows. “412 errors, 3 distinct, here are the 3” beats 412 stack traces.

A log search tool built that way, with the TypeScript MCP SDK:

server.ts

```
server.registerTool(
  'search_logs',
  {
    description: 'Search logs. Returns at most `limit` lines, newest first. ' +
      'Pass `cursor` from the previous answer to get older lines.',
    inputSchema: {
      query: z.string(),
      since: z.string().describe('ISO time or "1h", "24h"').default('1h'),
      level: z.enum(['error', 'warn', 'info']).optional(),
      limit: z.number().int().min(1).max(200).default(50),
      cursor: z.string().optional(),
    },
  },
  async ({ query, since, level, limit, cursor }) => {
    const page = await logs.search({ query, since, level, limit, cursor })
    const lines = page.lines.map((l) => `${l.time} ${l.level} ${l.message.slice(0, 500)}`)
    const more = page.next ? `\n${page.total - limit} more. Call again with cursor "${page.next}".` : ''
    return { content: [{ type: 'text', text: lines.join('\n') + more }] }
  },
)
```

Say the limits in the description. The model reads it before calling, and a description that mentions `limit` and `cursor` gets paged calls instead of one giant one.

## What about results that really are big?

Return a link instead of the data. The MCP spec lets a tool return a `resource_link`: a URI the client can fetch if the model decides it needs the content. The tool answers with a summary and the link, and the bulk never enters the context unless asked for:

tools/call result

```
{
  "content": [
    { "type": "text", "text": "Export ready: 48,210 rows. Read it only if you need every row." },
    {
      "type": "resource_link",
      "uri": "exports://2026-12-02/orders.csv",
      "name": "orders.csv",
      "mimeType": "text/csv"
    }
  ]
}
```

Structured results count twice

A tool that returns `structuredContent` should also return the same JSON as text, per the spec. Keep structured results small, or the answer is double the size you expect.

## How do I fix it when I don’t own the server?

- Ask for less in the prompt: name the time range, the project, the status, and say how many results you want.
- Check the tool’s schema for filter and limit parameters the model isn’t using, and mention them by name.
- Prefer the server’s narrower tools. Many servers have a `get_*` for one item next to a `list_*` or `search_*` that returns everything.
- Ask the server’s maintainers for a limit parameter. It is usually a small change, and every user of the server benefits.
- Cap the answer before it reaches the model, at a proxy or gateway in front of the server.

## How MCP1 caps tool answers

MCP1 is an MCP gateway, so every tool answer passes through it. Each workspace has an answer size limit, 1 MB by default, set under Settings, General (0 turns it off). Past the limit, text is cut, binary parts are left out, and the model gets a note telling it how to ask again:

Tool result

```
[MCP1 cut this answer from 3412 KB to fit this workspace’s 1024 KB limit.
Ask for less, for example with a filter, a smaller time range or a page size.]
```

A structured result that alone is over the limit comes back as an error with the same advice, since a tool with an output schema can’t return half its structure. Each cut is recorded in the [audit log](https://mcp1.com/blog/mcp-audit-logging) with the size before and after, so you can see which tools to fix upstream. In our own use at Appwrite, a smaller limit than the default gave better answers. The [docs](https://mcp1.com/docs) cover workspace settings, and the Individual plan is free to [start with](https://mcp1.com/signup).

## Common questions

### What is the default MAX\_MCP\_OUTPUT\_TOKENS in Claude Code?

25,000 tokens. Claude Code warns past 10,000 tokens, and saves a successful text result longer than 50,000 characters to a file whatever the variable says.

### Does MCP have pagination for tool results?

No. MCP’s pagination covers list operations such as tools/list and resources/list. A tool that pages its results defines its own limit and cursor parameters.

### Should I just raise the limit?

Only for a session that needs a whole result, such as one long file. Large results cost tokens on every later turn and make answers worse.

### How can a tool return a large file without filling the context?

Return a resource\_link with a short summary. The client fetches the linked resource only if the model needs it.

Give your team one URL

Create a workspace, install your servers and share a gateway with a group. Free for individuals.

[Start with MCP1](https://mcp1.com/signup)[Read the docs](https://mcp1.com/docs)

## More from the blog

[ \~/.codex/config.toml[mcp_servers.notion] url = "https://mcp.notion.com/mcp"codex mcp login notionSigned inHow to connect Notion MCP to CodexRun codex mcp add notion --url https://mcp.notion.com/mcp, then codex mcp login notion. Approvals, a token for CI, team config and fixes.![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite](https://mcp1.com/blog/notion-mcp-codex)[ Where PHI goes in one tool callMCP serverBAA, endpoint in scopeModel providerBAA, product namedGatewayBAA, audit logLogsEncrypted, retention setMCP and HIPAA: what to check before agents touch PHIEvery party that handles PHI in an MCP tool call needs a BAA, and model providers’ BAAs don’t cover MCP servers. What to check, limit and log.![](https://avatars.githubusercontent.com/u/1297371?s=96&v=4)Eldad FuxFounder and CEO, Appwrite](https://mcp1.com/blog/mcp-hipaa)

---

This is the markdown copy of https://mcp1.com/blog/mcp-tool-response-too-large. Site index for agents: https://mcp1.com/llms.txt
