Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.sedata-ai.tech/llms.txt

Use this file to discover all available pages before exploring further.

class ConfigValidator {
  static validate(config: TelemetryConfig): void
}
A small static class that asserts a TelemetryConfig is well-formed. Used internally by TelemetryManager’s constructor — exposed publicly so you can validate configs in tests, CLIs, or at deploy time.

Method

validate(config: TelemetryConfig): void

Throws on invalid input. Returns nothing on success.

Rules enforced

RuleError message
exporterEndpoint required unless exporterType: 'console'exporterEndpoint is required
samplingRate must be in [0, 1] (when set)samplingRate must be between 0 and 1
metricExportIntervalMs must be > 0 (when set)metricExportIntervalMs must be >0
batchTimeoutMs must be >= 0 (when set)batchTimeout must be >=0
exporterAuth.type === 'bearer' requires tokenBearer token is required when using bearer auth
exporterAuth.type === 'apiKey' requires apiKeyAPI key is required when using apiKey auth
exporterAuth.type === 'basic' requires username + passwordUsername and password are required when using basic auth

Example

import { ConfigValidator } from '@sedata-ai/mcp'

try {
  ConfigValidator.validate({
    serverName: 'my-server',
    serverVersion: '1.0.0',
    samplingRate: 1.5,
  })
} catch (err) {
  console.error('Bad config:', (err as Error).message)
  // → Bad config: samplingRate must be between 0 and 1
}

Use cases

Config tests

Assert your environment-driven config is valid in unit tests.

Bootstrap script

Fail fast at deploy time before connecting any transports.