Skip to main content
Glama

sixta-connect

Rewrite a query to fix an anti-pattern (SIXTA)

sixta_rewrite_query
Read-onlyIdempotent

Turn a flagged anti-pattern into the safe, equivalent rewrite — no connection needed. Paste a SQL query and get ready-to-run rewrites anchored to deterministic rules: = NULLIS NULL, NOT IN (subquery)NOT EXISTS (NULL-safe), deep OFFSET → keyset pagination, ORDER BY RAND() → a keyed random sample — each with its semantics caveat spelled out. Every literal rewrite is then re-analyzed in-process and reported as 'clean' or 'still flags X', so the safe rewrite is self-checked — no need to feed it back through sixta_analyze_query. Use when the user asks 'how do I fix / rewrite this query' or after sixta_analyze_query flags a smell. Input is analyzed in memory and never stored.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesThe SQL query to rewrite (paste it verbatim)
engineNoDatabase engine: postgresql or mysql. Optional but improves the rewrite (e.g. random-sample syntax).
versionNoEngine version, e.g. '16' (PostgreSQL major) or '8.0.35' (MySQL). Omit for a modern default; some verdicts are version-dependent and the assumption is stated in the result.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
engineNoEngine the analysis targeted, when known.
reportYesThe full human-readable SIXTA report (markdown).
findingsNoNamed findings as structured data, when the tool produces them.
finding_countNoNumber of findings/issues identified.
overall_severityNoHighest severity across findings (Critical/High/Medium/Low/Info).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.9/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Beyond annotations (readOnlyHint, idempotentHint, destructiveHint), the description adds key behaviors: no connection needed, in-memory analysis, self-checked rewrite results ('clean' or 'still flags X'), eliminating need to re-run sixta_analyze_query. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single dense paragraph with no redundant text. It efficiently conveys purpose, examples, usage, and behavioral guarantees. Every sentence adds value.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity and presence of output schema, the description covers purpose, usage, behavior, and parameter semantics comprehensively. It explains the self-checking mechanism, which is crucial for an agent to avoid unnecessary round-trips. No gaps identified.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds practical guidance: 'paste it verbatim' for query, 'optional but improves the rewrite' for engine, and 'omit for modern default' for version with version-dependent behavior note.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Turn a flagged anti-pattern into the safe, equivalent rewrite'. It lists specific transformations and distinguishes itself from sibling sixta_analyze_query by noting it is used after analysis flags a smell.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicit usage guidance: 'Use when the user asks "how do I fix / rewrite this query" or after sixta_analyze_query flags a smell'. Also notes that input is never stored, which is a critical usage constraint.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources