Skip to main content

logger(opts?)

  • logs tool start, end, and error events
  • default level: info
  • default writer: console.log

analytics(opts?)

  • emits execution analytics
  • sink: "console", "posthog", or a custom function
  • default sink: "console"

apiKey(opts?)

  • validates an HTTP header
  • default header: x-api-key
  • stores the validated value on ctx

bearer(opts?)

  • validates Authorization bearer tokens
  • default scheme: Bearer
  • stores the parsed token on ctx.token

rateLimit(opts?)

  • in-memory rate limiting
  • default: 60 calls per "1m"

cache(opts?)

  • in-memory result caching
  • default ttl: 60_000 ms