Skip to main content
Glama

Query Database

query_database
Read-onlyIdempotent

Run read-only SQL against a configured MySQL database to retrieve rows; optionally target a specific database via JDBC URL when needed.

Instructions

Run a read-only SQL query against the configured MySQL database and return rows.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "sql": "<sql>"
    },
    "name": "query_database"
  }
}

Input Schema

NameRequiredDescriptionDefault
sqlYesSQL query to execute
jdbc_urlNoOptional JDBC URL to target a specific database (credentials embedded in URL); uses environment default when omitted

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv1.2.1
    • addedInput schema / properties / jdbc_url
      Added value: +{
      +  "description": "Optional JDBC URL to target a specific database (credentials embedded in URL); uses environment default when omitted",
      +  "type": "string"
      +}
  2. First observedv1.0.1

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, destructiveHint=false and openWorldHint=true, so safety and network exposure are covered. The description confirms the read-only contract and that rows are returned, but adds nothing about row limits, timeouts, error behavior, or what happens if a write statement is submitted.

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?

A single front-loaded sentence with the read-only constraint and return behavior stated up front and zero redundant wording. Nothing could be removed without losing information.

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

Completeness4/5

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

For a two-parameter read tool with rich annotations and a fully described schema, the description covers the essentials. The only meaningful gap is operational limits (max rows, timeouts, handling of non-SELECT input), which an agent would benefit from knowing before invoking.

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 parameters (sql and jdbc_url) are already documented in the schema, including the credentials-in-URL behavior and the environment default. The description adds no further parameter meaning, which is acceptable at full coverage but earns no bonus.

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+resource ('Run a read-only SQL query') plus the target system (configured MySQL database) and the outcome ('return rows'). It is clear enough to distinguish from a mutation tool, though it does not name which sibling to use for query planning (e.g., explain_query) or schema inspection.

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

Usage Guidelines2/5

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

The word 'read-only' implies the intended class of statements, but there is no explicit when-to-use, no when-not-to-use, and no reference to alternatives such as explain_query, describe_table, or json_query. The agent must infer routing from sibling names alone.

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