MCPcopy Create free account
hub / github.com/freecodexyz/free-code / isValidAPIMessage

Function isValidAPIMessage

src/services/api/errors.ts:387–398  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

385 * Type guard to check if a value is a valid Message response from the API
386 */
387export function isValidAPIMessage(value: unknown): value is BetaMessage {
388 return (
389 typeof value === 'object' &&
390 value !== null &&
391 'content' in value &&
392 'model' in value &&
393 'usage' in value &&
394 Array.isArray((value as BetaMessage).content) &&
395 typeof (value as BetaMessage).model === 'string' &&
396 typeof (value as BetaMessage).usage === 'object'
397 )
398}
399
400/** Lower-level error that AWS can return. */
401type AmazonError = {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected