Skip to main content
Glama
kpconnell
by kpconnell

query_database

Execute read-only SQL queries (SELECT, SHOW, DESCRIBE, EXPLAIN, WITH) on MariaDB or MSSQL databases. Results are capped at a configurable row limit for safe, restricted access.

Instructions

Execute a read-only SQL query against one of the configured database connections. Pass connection with the name of the target (omit if only one connection exists — use list_connections to see the names and which engine each uses). Only read statements are allowed (SELECT/SHOW/DESCRIBE/EXPLAIN/WITH on MariaDB; SELECT/WITH and a small allowlist of sp_help / sp_columns / sp_tables procs on MSSQL). Results are capped at a configurable row limit (default 1000). Use list_schema first if you don't know the table structure.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionNo
sqlYes
Behavior4/5

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

Discloses critical behaviors: read-only constraint, allowed statement types per database engine, and configurable row limit. With no annotations, this is sufficient for safe use, though transaction handling and timeouts are not mentioned.

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?

Three concise sentences, front-loaded with core purpose, followed by necessary constraints and guidance. No redundant 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?

Covers purpose, engine-specific allowed statements, row limit, and dependencies on other tools. Lacks detail on return format or error handling, but provides adequate context for an AI agent to use the tool 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?

Adds meaningful context to both parameters: explains connection's purpose, when to omit, and how to find valid values via list_connections. For sql, reinforces allowed statement types. With 0% schema coverage, this adds significant value.

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?

Clearly states the verb 'execute', the resource 'SQL query', and the constraint 'read-only' against 'configured database connections'. Distinguishes from sibling tools like list_connections and list_schema.

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?

Explicitly directs to use list_connections to discover connection names and engines, and list_schema for table structure before querying. States when the connection parameter can be omitted and lists allowed SQL statements per engine.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kpconnell/db-oauth-mcp-node'

If you have feedback or need assistance with the MCP directory API, please join our Discord server