MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / isToolExchangeAdjacencyError

Function isToolExchangeAdjacencyError

packages/kosong/src/errors.ts:218–224  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

216] as const;
217
218export function isToolExchangeAdjacencyError(error: unknown): boolean {
219 if (!(error instanceof APIStatusError)) return false;
220 if (error instanceof APIContextOverflowError) return false;
221 if (error.statusCode !== 400 && error.statusCode !== 422) return false;
222 const lowerMessage = error.message.toLowerCase();
223 return TOOL_EXCHANGE_ADJACENCY_MESSAGE_PATTERNS.some((pattern) => pattern.test(lowerMessage));
224}
225
226// The broader family of structural request rejections a strict provider returns
227// when the message array itself is malformed — tool_use/tool_result pairing,

Callers 2

errors.test.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected