Skip to main content
Glama

list_top_sql

Retrieve top-N SQL statements by buffer gets, disk reads, elapsed time, executions, or CPU time to identify high-load queries, with sql_id, metrics, and a 200-char SQL preview.

Instructions

Top-N SQL statements ordered by buffer_gets (default), disk_reads, elapsed_time, executions or cpu_time. Returns sql_id, executions, gets/reads/elapsed and a 200-char SQL preview.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of rows to return (default 10).
orderByNoSort key: 'buffer_gets' (default), 'disk_reads', 'elapsed_time', 'executions', 'cpu_time'.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv2.16.3

TDQS

B3.4/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It usefully discloses the return shape (sql_id, executions, gets/reads/elapsed, 200-char preview), but omits whether the operation is read-only, what time/AWR window is scanned, and any cost or permission implications.

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

Conciseness4/5

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

Two tight sentences with the ordering options and the return fields front-loaded; nothing is padded. It is efficient, though the second sentence could have been leveraged for missing behavioral context.

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

Completeness3/5

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

With no output schema and no annotations, the description does describe the returned columns, which is helpful. However, for a performance-ranking tool the time scope (AWR window vs. since startup) and the read-only nature are unstated, leaving meaningful gaps.

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

Parameters3/5

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

Schema description coverage is 100%, so both limit and orderBy are already fully documented with defaults and the enum of keys. The description restates the same ordering options and the top-N behavior without adding syntax, format, or boundary details beyond the schema.

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

Purpose4/5

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

States a specific verb and resource (list top-N SQL statements) plus the ordering dimension, and names the candidate sort keys. An agent can tell this reports SQL performance ranking, though it draws no explicit line against siblings like get_wait_events or get_session_sql_text.

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

Usage Guidelines3/5

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

Usage is implied by the top-SQL framing (performance triage) but the description never states when to reach for it versus alternatives such as explain_plan, run_sql_tuning_advisor, or list_active_sessions. No prerequisites or exclusions are given.

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