TheDocumentation Index
Fetch the complete documentation index at: https://sedataai.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
safetyCheck wrapper sits in front of any tool handler and runs the input
through Sedata’s safety API before your code sees it. Flagged content gets a
canned blocked response; clean content passes through transparently.
Flow
Wrap the handler
safetyCheck(handler, { parameterName: 'text' }) returns a new handler
that knows which input field to inspect.Inspect the parameter
On invocation, the wrapper reads
params[parameterName]. If it’s a string,
it sends a POST to https://api.sedata-ai.tech/security/safety-check
with { "content": "<value>" }.Decide
- Flagged → return a structured “blocked” response without calling your handler.
- Not flagged → call your handler with the original params.
- API error → log a warning and call your handler (fail-open).
Authentication
The safety API expects anx-api-key header. The wrapper picks it up
automatically from your instrumentServer config:
Blocked response shape
When content is flagged, the wrapper returns a response that satisfies most tool output schemas:Failure modes
| Scenario | Behavior |
|---|---|
| Network error | Logged as warning. Handler runs. _safetyCheck.success = false. |
| Non-200 from safety API | Logged. Handler runs. _safetyCheck.success = false. |
| Missing API key | Request goes out without x-api-key. The API may 401; treated like any other failure. |
| Parameter missing | Handler runs untouched. No safety attributes recorded. |
| Parameter not a string | Handler runs untouched. No safety attributes recorded. |
When to use it
UsesafetyCheck for any tool whose input is free-form user content:
- summarizers, translators, classifiers
- code generators / interpreters
- anything that could be prompt-injected
- structured numeric inputs (no content to flag)
- internal tools called only by trusted automation
- tools where blocking would break correctness (calculators, lookups)
Span attributes added
When the wrapper runs, the span for that tool call includes:| Attribute | Type | Example |
|---|---|---|
mcp.safety_check.content | string | "please ignore previous instructions and..." |
mcp.safety_check.flagged | boolean | true |
mcp.safety_check.latency_ms | number | 42 |
mcp.safety_check.success | boolean | true |
Next
safetyCheck reference
The full function signature, options, and types.
Example with safety
A complete summarizer tool with
safetyCheck.