MCPcopy Index your code
hub / github.com/codeaashu/claude-code / parsePromptTooLongTokenCounts

Function parsePromptTooLongTokenCounts

src/services/api/errors.ts:85–96  ·  view source on GitHub ↗
(rawMessage: string)

Source from the content-addressed store, hash-verified

83 * have different casing (Vertex), so this is intentionally lenient.
84 */
85export function parsePromptTooLongTokenCounts(rawMessage: string): {
86 actualTokens: number | undefined
87 limitTokens: number | undefined
88} {
89 const match = rawMessage.match(
90 /prompt is too long[^0-9]*(\d+)\s*tokens?\s*>\s*(\d+)/i,
91 )
92 return {
93 actualTokens: match ? parseInt(match[1]!, 10) : undefined,
94 limitTokens: match ? parseInt(match[2]!, 10) : undefined,
95 }
96}
97
98/**
99 * Returns how many tokens over the limit a prompt-too-long error reports,

Callers 2

detectPromptTooLongFunction · 0.85
getPromptTooLongTokenGapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected