oxmysql plugin

Gated SQL. SELECT-only by default; expand the verb allowlist when you mean it.

Detects oxmysql. Uses @overextended/oxmysql for typed access. Defaults to SELECT only — the operator has to opt in to writes.

Tools

ToolReturns
oxmysql_query({ query, params?, rowLimit? }){ rowCount, truncated, rows }
oxmysql_scalar({ query, params? }){ value }
oxmysql_execute({ query, params? }){ result }affectedRows etc., depending on the verb

Gates

Two convars gate every call:

set agent_api_plugin_oxmysql_readonly         true       # SELECT-only when true
set agent_api_plugin_oxmysql_allow_statements "SELECT"   # csv, uppercase

Behaviour:

  • If readonly is true, any verb other than SELECT returns COMMAND_NOT_ALLOWED.
  • Independently, the first word of the query (uppercased) must appear in allow_statements.

To open up CRUD on app-owned tables:

set agent_api_plugin_oxmysql_readonly         false
set agent_api_plugin_oxmysql_allow_statements "SELECT,INSERT,UPDATE,DELETE"

To open DDL (extremely dangerous, only for ephemeral test databases):

set agent_api_plugin_oxmysql_allow_statements "SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER"

Examples

oxmysql_query({ query: "SELECT identifier, name FROM users LIMIT 5" })
// → { rowCount: 5, truncated: false, rows: [...] }

oxmysql_query({
  query: "SELECT * FROM owned_vehicles WHERE owner = ?",
  params: ["steam:11000013da16e3f"],
  rowLimit: 50
})

oxmysql_scalar({ query: "SELECT COUNT(*) FROM users" })
// → { value: 142 }

// Mutation (needs readonly=false + allow_statements expanded)
oxmysql_execute({
  query: "UPDATE users SET banned = ? WHERE identifier = ?",
  params: [1, "steam:..."]
})

Compatibility

  • Uses oxmysql.query, oxmysql.scalar, oxmysql.rawExecute from the typed wrapper. The underlying resource just has to expose these (which it does).
  • rowLimit caps the rows returned to the agent (default 100). The underlying query still scans the table — use SQL LIMIT for engine-level cap.
  • Connection pool, timeouts, and dialect are all oxmysql concerns — agent_api is a thin pass-through.