Tool Result Size Constants (constants/toolLimits.ts)

gitingest_Gitlawb_openclaude · src/constants/toolLimits.ts · typescript · MIT
ai, lang:typescript, tag:constants, tag:tokens, tag:limits

Defines system-wide character, token, and byte limits for tool outputs. Reuse when enforcing context window boundaries in AI chat or agent applications.

// Source: https://github.com/Gitlawb/openclaude | License: MIT | Copyright Anthropic PBC. All rights reserved
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Constants related to tool result size limits
 */

/**
 * Default maximum size in characters for tool results before they get persisted
 * to disk. When exceeded, the result is saved to a file and the model receives
 * a preview with the file path instead of the full content.
 *
 * Individual tools may declare a lower maxResultSizeChars, but this constant
 * acts as a system-wide cap regardless of what tools declare.
 */
export const DEFAULT_MAX_RESULT_SIZE_CHARS = 50_000

/**
 * Maximum size for tool results in tokens.
 * Based on analysis of tool result sizes, we set this to a reasonable upper bound
 * to pre

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key