MCPcopy Create free account
hub / github.com/Effect-TS/effect / checkMessageLength

Function checkMessageLength

packages/effect/src/chat/ChatAdapter.ts:396–408  ·  view source on GitHub ↗
(
  descriptor: Descriptor,
  op: string,
  markdown: string,
  actions?: ReadonlyArray<Action> | undefined
)

Source from the content-addressed store, hash-verified

394 * @since 4.1.5
395 */
396export const checkMessageLength = (
397 descriptor: Descriptor,
398 op: string,
399 markdown: string,
400 actions?: ReadonlyArray<Action> | undefined
401): Effect.Effect<void, ChatError> =>
402 descriptor.measure(markdown, actions ?? []) <= descriptor.limits.messageLength ? Effect.void : Effect.fail(
403 new ChatError({
404 platform: descriptor.platform,
405 op,
406 reason: new TooLarge({ subject: "text", detail: "message_too_long" })
407 })
408 )
409
410const maxRetries = 3
411const baseDelay = Duration.millis(500)

Callers 5

makeFunction · 0.90
adapter.tsFile · 0.90
makeFunction · 0.90
bodyFunction · 0.90
makeFakeFunction · 0.90

Calls 1

failMethod · 0.65

Tested by

no test coverage detected