Skip to main content
Glama
AI Site Manager MCP
by nkd3v

aism_db_query

Read-onlyIdempotent

Run one read-only SQL query to count or inspect site database data and return columns plus rows, with writes and sensitive tables blocked.

Instructions

Run ONE read-only SQL query (SELECT, WITH, TABLE, SHOW, DESCRIBE or EXPLAIN) against the site database, for example to count or inspect plugin data. Runs in a read-only transaction with a time limit; comments, write/locking keywords, variables, backslashes and references to the users, usermeta and API key tables are rejected. Use the table prefix from aism_db_tables. Returns columns plus rows as arrays; long values are cut to max_value_bytes and obvious secrets are redacted. Add LIMIT/aggregates for large tables. The SQL is recorded in the site's activity log. Requires database:read and manage_options (companion 1.6.0+).

Input Schema

NameRequiredDescriptionDefault
sqlYes
siteNoConfigured site name from aism_sites. Omit for the default site.
max_rowsNo
max_value_bytesNo
timeout_secondsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv1.7.0

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already declare readOnlyHint/idempotentHint, but the description adds substantial independent context: read-only transaction with a time limit, rejection of comments/write/locking keywords/variables/backslashes, value truncation to max_value_bytes, secret redaction, and activity-log recording. The only gap is it doesn't spell out row limits per call beyond max_rows defaults or pagination behavior.

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?

Front-loaded with the primary action and allowed statement types, followed by constraints, prerequisites, and return shape. Every sentence adds non-redundant information with no 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?

With no output schema, the description still specifies return format ('columns plus rows as arrays') and truncation/redaction behavior, which is exactly the missing context an agent needs. Combined with privilege requirements (database:read, manage_options), it is complete enough to call correctly.

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 only 20%, so the description must carry weight, and it does for the core sql parameter by defining accepted syntax and restrictions. It also explains max_value_bytes (truncation) and implies the time limit and row limits, though it never names max_rows or timeout_seconds explicitly, leaving the numeric bounds to the schema.

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?

States a specific verb and resource ('Run ONE read-only SQL query') and enumerates the exact statement types accepted (SELECT, WITH, TABLE, SHOW, DESCRIBE, EXPLAIN). It also distinguishes itself from siblings by directing the agent to aism_db_tables for the table prefix, so an agent can tell it apart from aism_db_table and aism_db_tables.

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?

Gives concrete when-to-use context ('to count or inspect plugin data'), names the companion tool for prefixes (aism_db_tables), and states when-not via rejected keywords and forbidden tables (users, usermeta, API key tables). Guidance on adding LIMIT/aggregates for large tables rounds out the selection and invocation advice.

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