Skip to main content
Glama
clidey

whodb-cli

Official

whodb_query

Execute SQL queries (SELECT, INSERT, UPDATE, DELETE) against a database. Parameterized queries ensure safe handling of user input.

Instructions

Execute a SQL query against a database connection.

Best for: Running SQL SELECT, INSERT, UPDATE, DELETE statements when you need to query or modify data. Not recommended for: Schema exploration (use whodb_schemas, whodb_tables, whodb_columns instead for faster, structured results). Common mistakes: Running queries without specifying connection when multiple exist; using SELECT * instead of specific columns; forgetting LIMIT on large tables.

Usage Example (simple query):

{
  "name": "whodb_query",
  "arguments": {
    "connection": "mydb",
    "query": "SELECT id, name, email FROM users WHERE active = true LIMIT 10"
  }
}

Usage Example (parameterized query - RECOMMENDED for user input):

{
  "name": "whodb_query",
  "arguments": {
    "connection": "mydb",
    "query": "SELECT * FROM users WHERE id = $1 AND status = $2",
    "parameters": [123, "active"]
  }
}

Placeholder syntax by database: PostgreSQL uses $1, $2, $3; MySQL/SQLite/DuckDB/ClickHouse use ?

Best practices:

  • Use parameterized queries when incorporating user-provided values - this prevents SQL injection

  • Always use LIMIT for exploratory queries to avoid overwhelming results

  • Prefer specific column selection over SELECT *

  • Check schema structure with whodb_columns before writing complex queries

Security Mode: CONFIRM-WRITES (Default) Write operations (INSERT, UPDATE, DELETE, etc.) require user confirmation. When you submit a write query:

  1. The query is validated but NOT executed

  2. You receive a confirmation_token

  3. Explain to the user what the query will do

  4. Call whodb_confirm with the token after user approves

  5. The query executes and returns results

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionYesConnection name (optional if only one exists)
queryYesSQL query to execute
parametersNoParameterized query values ($1/$2 for Postgres or ? for MySQL/SQLite)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
columnsYes
column_typesNo
rowsYes
errorNo
warningNo
confirmation_requiredNo
confirmation_tokenNo
confirmation_queryNo
confirmation_expiryNo
request_idNo
Behavior5/5

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

Beyond the destructiveHint annotation (false), the description details the CONFIRM-WRITES security mode, including the confirmation flow and placeholder syntax per database, adding significant behavioral context.

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?

The description is well-structured with sections, examples, and bullet points, but is somewhat lengthy. It is front-loaded and every section contributes, though a few sentences could be trimmed without loss.

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?

Given the tool's complexity (SQL writes, parameter safety, confirmation flow), the description covers usage examples, security mode, best practices, and sibling references exhaustively, making it highly complete.

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?

With 100% schema coverage, baseline is 3. The description adds value with usage examples, parameterized query recommendations, and placeholder syntax details, exceeding the baseline.

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?

The description clearly states 'Execute a SQL query against a database connection' and distinguishes from sibling tools (whodb_schemas, whodb_tables, whodb_columns) for schema exploration, making the purpose specific and differentiating.

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?

The description provides explicit 'Best for' and 'Not recommended for' sections, names specific alternatives, and lists common mistakes, offering strong guidance on when and how to use the tool.

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/clidey/whodb'

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