# SQL Query Safety Preflight Check

> SQL Query Safety Preflight Check is a paid API for AI agents from api.agentstools.dev, paid per call via x402, $0.02/call, status unknown (last checked 2026-09-15).

Analyzes a SQL query before execution and returns a pass/caution/block verdict with per-finding severity, reason, and suggested fix for Postgres, MySQL, or SQLite.

## Facts

- Endpoint: POST https://api.agentstools.dev/sql/check
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/sql-query-safety-preflight-check-7a544d44
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ToMs8y98EOwRdTPhxj1oN

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability sql-query-safety-preflight-check-7a544d44 -d '<json body>'
```

Example prompt: Before running this query, do a safety preflight check on it for Postgres and tell me if it's safe, needs caution, or should be blocked — and explain any findings: DELETE FROM orders WHERE status = 'pending';

## When to prefer this

Use this endpoint when an AI agent or automated pipeline needs to validate SQL before executing it, especially in autonomous or low-oversight workflows where a dangerous query (e.g. DROP TABLE, DELETE without WHERE) could cause irreversible harm. Prefer this over manual review when speed and consistency matter, or when the query was generated dynamically by an LLM. Best suited for Postgres, MySQL, and SQLite workloads where a lightweight, per-query safety gate is needed without spinning up a full database linter or query planner.

## Known failure modes

- Malformed or non-parseable SQL returns an error or block verdict
- Unsupported dialect returns a validation error
- Missing required 'sql' field returns a 400-style error
- Very complex or extremely long queries may produce incomplete analysis
- Findings are indicators, not guarantees — a 'pass' does not certify the query is production-safe

## How this service works

Safety and performance preflight for a database query BEFORE you run it. Send the query for Postgres, MySQL or SQLite and get a pass, caution or block verdict with per-finding operation, severity, plain-language reason and a fix. Query-safety indicators, not a guarantee.

## Output

Returns a top-level verdict of pass, caution, or block, along with a list of findings each containing the operation type, severity level, a plain-language reason explaining the risk or performance concern, and a suggested fix to resolve it.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "sql": {
   "type": "string",
   "description": "The query text to check"
  },
  "dialect": {
   "enum": [
    "postgres",
    "mysql",
    "sqlite",
    "bigquery",
    "snowflake"
   ],
   "type": "string",
   "description": "Database dialect (default postgres)"
  },
  "options": {
   "type": "object",
   "description": "Optional hints, e.g. indexed_columns: list of column names to refine performance findings"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/sql-query-safety-preflight-check-7a544d44/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.agentstools.dev](https://www.zero.xyz/host/api.agentstools.dev/llms.txt)
