Skip to main content
Glama

query_firewall

Destructive

Manage and test per-connection SQL firewall rules that block, warn, or log matching queries — distinct from pii_scan, which scans stored data (not SQL text) for PII. action=add_rule creates a rule (rule_name + RE2 pattern; optional block_action: block/warn/log, default block — only "block" is enforced, "warn"/"log" are advisory-only). action=remove_rule deletes by name or id. action=list_rules is read-only. action=test_query checks a sql string against the built-in guard plus your rules and returns a verdict without running it. add_rule/remove_rule write; changes take effect within 60s. All actions count against quota. Limits: 50 rules/connection, 512-char patterns. [ARCHITECT tier]

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sqlNoSQL to test against rules
actionYesWhat to do
messageNoMessage shown when rule triggers
patternNoRegex pattern to match
rule_nameNoRule name
connectionNoTarget connection name from this tenant's inventory. Call `list_connections` to see every name + dialect, then match semantically to the user's intent (e.g. 'analytics' → a connection named `*-analytics-*`; 'prod' → a connection with `prod-` prefix). If the user didn't specify, use the tenant's default (first added). Do not invent names — resolve from `list_connections` output.
block_actionNoAction when matched (default block)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNo
metaNo
displayNo
summaryNo
insightsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedOutput schema / properties / data / anyOf
      Previous value: -[
      -  {
      -    "items": {
      -      "additionalProperties": true,
      -      "properties": {
      -        "action": {
      -          "type": "string"
      -        },
      -        "message": {
      -          "type": "string"
      -        },
      -        "name": {
      -          "type": "string"
      -        },
      -        "pattern": {
      -          "type": "string"
      -        }
      -      },
      -      "type": "object"
      -    },
      -    "type": "array"
      -  },
      -  {
      -    "additionalProperties": true,
      -    "properties": {
      -      "action": {
      -        "type": "string"
      -      },
      -      "added": {
      -        "type": "boolean"
      -      },
      -      "message": {
      -        "type": "string"
      -      },
      -      "name": {
      -        "type": "string"
      -      },
      -      "pattern": {
      -        "type": "string"
      -      },
      -      "rule_name": {
      -        "type": "string"
      -      }
      -    },
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": true,
      -    "properties": {
      -      "action": {
      -        "type": "string"
      -      },
      -      "allowed": {
      -        "type": "boolean"
      -      },
      -      "matched": {
      -        "type": "boolean"
      -      },
      -      "matched_rule": {
      -        "type": "string"
      -      },
      -      "message": {
      -        "type": "string"
      -      },
      -      "rule": {
      -        "type": [
      -          "string",
      -          "null"
      -        ]
      -      }
      -    },
      -    "type": "object"
      -  },
      -  {
      -    "additionalProperties": true,
      -    "properties": {
      -      "code": {
      -        "type": "string"
      -      },
      -      "details": {
      -        "additionalProperties": {},
      -        "type": "object"
      -      },
      -      "error": {
      -        "type": "string"
      -      },
      -      "internal_code": {
      -        "type": "string"
      -      },
      -      "message": {
      -        "type": "string"
      -      },
      -      "retry_after_s": {
      -        "type": "number"
      -      }
      -    },
      -    "type": "object"
      -  }
      -]New value: +[
      +  {
      +    "items": {
      +      "additionalProperties": true,
      +      "properties": {
      +        "action": {
      +          "type": "string"
      +        },
      +        "message": {
      +          "type": "string"
      +        },
      +        "name": {
      +          "type": "string"
      +        },
      +        "pattern": {
      +          "type": "string"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "type": "array"
      +  },
      +  {
      +    "additionalProperties": true,
      +    "properties": {
      +      "action": {
      +        "type": "string"
      +      },
      +      "added": {
      +        "type": "boolean"
      +      },
      +      "message": {
      +        "type": "string"
      +      },
      +      "name": {
      +        "type": "string"
      +      },
      +      "pattern": {
      +        "type": "string"
      +      },
      +      "rule_name": {
      +        "type": "string"
      +      }
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": true,
      +    "properties": {
      +      "action": {
      +        "type": "string"
      +      },
      +      "allowed": {
      +        "type": "boolean"
      +      },
      +      "matched": {
      +        "type": "boolean"
      +      },
      +      "matched_rule": {
      +        "type": "string"
      +      },
      +      "message": {
      +        "type": "string"
      +      },
      +      "rule": {
      +        "type": [
      +          "string",
      +          "null"
      +        ]
      +      }
      +    },
      +    "type": "object"
      +  },
      +  {
      +    "additionalProperties": true,
      +    "properties": {
      +      "code": {
      +        "type": "string"
      +      },
      +      "details": {
      +        "additionalProperties": {},
      +        "type": "object"
      +      },
      +      "error": {
      +        "type": "string"
      +      },
      +      "internal_code": {
      +        "type": "string"
      +      },
      +      "message": {
      +        "type": "string"
      +      },
      +      "retry_after_s": {
      +        "type": "number"
      +      }
      +    },
      +    "required": [
      +      "error"
      +    ],
      +    "type": "object"
      +  }
      +]
  2. Changed5 schema fields changed
    • addedInput schema / properties / connection / maxLength
      Added value: +256
    • addedInput schema / properties / message / maxLength
      Added value: +500
    • addedInput schema / properties / pattern / maxLength
      Added value: +2000
    • addedInput schema / properties / rule_name / maxLength
      Added value: +256
    • addedInput schema / properties / sql / maxLength
      Added value: +50000
  3. Changed2 schema fields changed
    • addedOutput schema / properties / display / properties / map
      Added value: +{
      +  "additionalProperties": true,
      +  "properties": {
      +    "label": {
      +      "type": "string"
      +    },
      +    "lat": {
      +      "type": "string"
      +    },
      +    "lon": {
      +      "type": "string"
      +    },
      +    "title": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
    • changedOutput schema / properties / display / properties / type / anyOf
      Previous value: -[
      -  {
      -    "enum": [
      -      "table",
      -      "chart",
      -      "metric",
      -      "code",
      -      "text",
      -      "list"
      -    ],
      -    "type": "string"
      -  },
      -  {
      -    "type": "string"
      -  }
      -]New value: +[
      +  {
      +    "enum": [
      +      "table",
      +      "chart",
      +      "metric",
      +      "code",
      +      "text",
      +      "list",
      +      "map"
      +    ],
      +    "type": "string"
      +  },
      +  {
      +    "type": "string"
      +  }
      +]
  4. Changed1 schema field changed
    • changedOutput schema / (root)
      Previous value: -nullNew value: +{
      +  "$schema": "http://json-schema.org/draft-07/schema#",
      +  "additionalProperties": true,
      +  "properties": {
      +    "data": {
      +      "anyOf": [
      +        {
      +          "items": {
      +            "additionalProperties": true,
      +            "properties": {
      +              "action": {
      +                "type": "string"
      +              },
      +              "message": {
      +                "type": "string"
      +              },
      +              "name": {
      +                "type": "string"
      +              },
      +              "pattern": {
      +                "type": "string"
      +              }
      +            },
      +            "type": "object"
      +          },
      +          "type": "array"
      +        },
      +        {
      +          "additionalProperties": true,
      +          "properties": {
      +            "action": {
      +              "type": "string"
      +            },
      +            "added": {
      +              "type": "boolean"
      +            },
      +            "message": {
      +              "type": "string"
      +            },
      +            "name": {
      +              "type": "string"
      +            },
      +            "pattern": {
      +              "type": "string"
      +            },
      +            "rule_name": {
      +              "type": "string"
      +            }
      +          },
      +          "type": "object"
      +        },
      +        {
      +          "additionalProperties": true,
      +          "properties": {
      +            "action": {
      +              "type": "string"
      +            },
      +            "allowed": {
      +              "type": "boolean"
      +            },
      +            "matched": {
      +              "type": "boolean"
      +            },
      +            "matched_rule": {
      +              "type": "string"
      +            },
      +            "message": {
      +              "type": "string"
      +            },
      +            "rule": {
      +              "type": [
      +                "string",
      +                "null"
      +              ]
      +            }
      +          },
      +          "type": "object"
      +        },
      +        {
      +          "additionalProperties": true,
      +          "properties": {
      +            "code": {
      +              "type": "string"
      +            },
      +            "details": {
      +              "additionalProperties": {},
      +              "type": "object"
      +            },
      +            "error": {
      +              "type": "string"
      +            },
      +            "internal_code": {
      +              "type": "string"
      +            },
      +            "message": {
      +              "type": "string"
      +            },
      +            "retry_after_s": {
      +              "type": "number"
      +            }
      +          },
      +          "type": "object"
      +        }
      +      ]
      +    },
      +    "display": {
      +      "additionalProperties": true,
      +      "properties": {
      +        "chart": {
      +          "additionalProperties": true,
      +          "properties": {
      +            "chartType": {
      +              "type": "string"
      +            },
      +            "color": {
      +              "type": "string"
      +            },
      +            "title": {
      +              "type": "string"
      +            },
      +            "x": {
      +              "type": "string"
      +            },
      +            "xLabel": {
      +              "type": "string"
      +            },
      +            "y": {
      +              "anyOf": [
      +                {
      +                  "type": "string"
      +                },
      +                {
      +                  "items": {
      +                    "type": "string"
      +                  },
      +                  "type": "array"
      +                }
      +              ]
      +            },
      +            "yLabel": {
      +              "type": "string"
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "code": {
      +          "additionalProperties": true,
      +          "properties": {
      +            "executable": {
      +              "type": "boolean"
      +            },
      +            "language": {
      +              "anyOf": [
      +                {
      +                  "enum": [
      +                    "sql",
      +                    "json",
      +                    "bash",
      +                    "typescript"
      +                  ],
      +                  "type": "string"
      +                },
      +                {
      +                  "type": "string"
      +                }
      +              ]
      +            },
      +            "title": {
      +              "type": "string"
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "metric": {
      +          "additionalProperties": true,
      +          "properties": {
      +            "label": {
      +              "type": "string"
      +            },
      +            "status": {
      +              "anyOf": [
      +                {
      +                  "enum": [
      +                    "good",
      +                    "warning",
      +                    "critical"
      +                  ],
      +                  "type": "string"
      +                },
      +                {
      +                  "type": "string"
      +                }
      +              ]
      +            },
      +            "trend": {
      +              "anyOf": [
      +                {
      +                  "enum": [
      +                    "up",
      +                    "down",
      +                    "neutral"
      +                  ],
      +                  "type": "string"
      +                },
      +                {
      +                  "type": "string"
      +                }
      +              ]
      +            },
      +            "trendValue": {
      +              "type": "string"
      +            },
      +            "unit": {
      +              "type": "string"
      +            },
      +            "value": {
      +              "type": [
      +                "string",
      +                "number"
      +              ]
      +            }
      +          },
      +          "type": "object"
      +        },
      +        "type": {
      +          "anyOf": [
      +            {
      +              "enum": [
      +                "table",
      +                "chart",
      +                "metric",
      +                "code",
      +                "text",
      +                "list"
      +              ],
      +              "type": "string"
      +            },
      +            {
      +              "type": "string"
      +            }
      +          ]
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "insights": {
      +      "items": {
      +        "additionalProperties": true,
      +        "properties": {
      +          "column": {
      +            "type": "string"
      +          },
      +          "message": {
      +            "type": "string"
      +          },
      +          "severity": {
      +            "anyOf": [
      +              {
      +                "enum": [
      +                  "info",
      +                  "warning",
      +                  "critical"
      +                ],
      +                "type": "string"
      +              },
      +              {
      +                "type": "string"
      +              }
      +            ]
      +          },
      +          "value": {}
      +        },
      +        "required": [
      +          "severity",
      +          "message"
      +        ],
      +        "type": "object"
      +      },
      +      "type": "array"
      +    },
      +    "meta": {
      +      "additionalProperties": true,
      +      "properties": {
      +        "cacheHit": {
      +          "type": "boolean"
      +        },
      +        "connection": {
      +          "type": "string"
      +        },
      +        "dialect": {
      +          "anyOf": [
      +            {
      +              "enum": [
      +                "postgres",
      +                "mysql",
      +                "mssql"
      +              ],
      +              "type": "string"
      +            },
      +            {
      +              "type": "string"
      +            }
      +          ]
      +        },
      +        "executionTimeMs": {
      +          "type": [
      +            "number",
      +            "string"
      +          ]
      +        },
      +        "plan": {},
      +        "rowCount": {
      +          "$ref": "#/properties/meta/properties/executionTimeMs"
      +        },
      +        "tool": {
      +          "type": "string"
      +        },
      +        "truncated": {
      +          "type": "boolean"
      +        }
      +      },
      +      "type": "object"
      +    },
      +    "summary": {
      +      "type": "string"
      +    }
      +  },
      +  "type": "object"
      +}
  5. First observed

TDQS

A4.7/5.0
Behavior5/5

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

Annotations already signal destructive/read flags, but the description goes well beyond: it names which actions write vs read, discloses the 60-second propagation delay, quota impact for all actions, rule/pattern limits, and the important caveat that warn/log are advisory-only while only block is enforced. No contradictions 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 dense but every sentence contributes: main purpose, sibling distinction, per-action behavior, enforcement caveat, propagation latency, quota, and hard limits. It is front-loaded with the core purpose and avoids filler.

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?

For a multi-action tool with 7 parameters and an output schema, the description covers action semantics, side effects, timing, quotas, limits, and the no-execution safety property of test_query. The connection parameter's resolution rules are already documented in the schema, so nothing needed for safe invocation is missing.

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 a baseline of 3 applies. The description adds meaningful usage semantics on top: add_rule requires rule_name + RE2 pattern, default block_action is block, warn/log are advisory, remove_rule accepts name or id, and test_query uses a sql string. It does not repeat plain schema field descriptions.

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 opens with a specific verb/resource ('Manage and test per-connection SQL firewall rules') and explains the block/warn/log behavior. It explicitly differentiates itself from the pii_scan sibling by what it operates on (SQL text vs stored data), so an agent can distinguish it immediately.

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

Usage Guidelines4/5

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

It gives action-by-action guidance (add_rule, remove_rule, list_rules, test_query) and explicitly says test_query does not run the SQL, which separates it from query execution tools. It names only pii_scan as a 'not this' alternative, so guidance is clear but not exhaustive across all siblings.

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