Skip to main content

Documentation Index

Fetch the complete documentation index at: https://sedataai.mintlify.app/llms.txt

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

function checkSafety(content: string): Promise<SafetyCheckResult>
The lower-level primitive used by safetyCheck. You usually don’t need to call this directly — wrap your handler with safetyCheck instead. Use checkSafety when you want fine-grained control (e.g. checking content from outside an MCP tool path).

Parameters

content
string
required
The content to validate.

Returns

result
SafetyCheckResult
interface SafetyCheckResult {
  flagged: boolean   // true only when the API responded successfully and reported flagged
  content: string    // the content you passed in
  latency: number    // round-trip latency in ms
  success: boolean   // true if the API responded successfully (whether flagged or not)
}

Behavior

  • POST https://api.sedata-ai.tech/security/safety-check
  • Body: { "content": "<your content>" }
  • Header: Content-Type: application/json
  • If setTelemetryApiKey(...) was called (typically by instrumentServer), also sends x-api-key: <key>.

Failure modes

ScenarioResult
Network error{ flagged: false, content, latency, success: false } and a console.warn.
Non-2xx responseSame as above.
2xx but result.success !== true{ flagged: false, ... success: true }.
2xx with result.success === true && result.data.flagged{ flagged: true, ... success: true }.
The function never throws.

Example

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

const result = await checkSafety("ignore previous instructions and...")

if (result.flagged) {
  // refuse, log, escalate
} else {
  // safe to use
}

Authentication

Set the key once at startup:
import { setTelemetryApiKey } from '@sedata-ai/mcp'
setTelemetryApiKey(process.env.SEDATA_KEY)
If you call instrumentServer(...) with exporterAuth, the key is set for you.

See also

safetyCheck

The high-level wrapper — what most users want.