環境変数

MAX_MCP_OUTPUT_TOKENS

MCP ツールのレスポンスに許容される最大トークン数(デフォルト:25000)。出力が10,000トークンを超えると Claude Code が警告を表示する。anthropic/maxResultSizeChars を宣言するツールはテキストコンテンツに対して代わりにその文字数制限を使用するが、それらのツールの画像コンテンツは引き続きこの変数の対象となる。その注釈を持たないツールによる50,000文字を超えるテキストの正常な結果は、この変数に関係なくファイルに保存される。

使い方・用途

  • MCP ツールが大量のテキストを返して上限を超え、都度ファイルに保存されるのを避けたい場合に上限値を引き上げる
  • 既定の 25,000 トークンでは切り詰められてしまうような大きな MCP ツール出力を Claude に扱わせたい場合に使う
  • 10,000 トークン超の警告は出つつも、実際に渡せる出力量をツールごとの個別設定なしで一括して調整したい場合に設定する
英語原文(公式ドキュメントより)

Maximum number of tokens allowed in MCP tool responses (default: 25000). Claude Code displays a warning when output exceeds 10,000 tokens. Tools that declare anthropic/maxResultSizeChars use that character limit for text content instead, but image content from those tools is still subject to this variable. A successful text result longer than 50,000 characters from a tool without that annotation is saved to a file regardless of this variable

関連ドキュメント