Skip to main content
Glama
clidey

whodb-cli

Official
by clidey

whodb_query

Execute SQL queries to retrieve, insert, update, or delete data from a connected database. Supports parameterized inputs for secure querying.

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
queryYesSQL query to execute
connectionYesConnection name (optional if only one exists)
parametersNoParameterized query values ($1/$2 for Postgres or ? for MySQL/SQLite)

Output Schema

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

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

The description discloses the CONFIRM-WRITES security mode, explaining that write operations are not executed immediately, require a confirmation_token, and must go through whodb_confirm. It also clarifies that even write queries return results after confirmation. This adds substantial behavioral context beyond the basic readOnlyHint/destructiveHint annotations.

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 quite long but well-organized into labeled sections with code examples. Key information is front-loaded (purpose, best-for, not-recommended). While somewhat verbose, the length is justified given the tool's complexity (SQL execution, write confirmation, parameterization).

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?

The description covers the tool's purpose, usage guidance, security mode, parameterization, common pitfalls, and alternatives. An output schema exists, so detailed return-value descriptions are unnecessary. It provides complete operational context for safe and effective use.

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?

The input schema already has 100% coverage with descriptions for all three parameters. The description enhances this with usage examples for both simple and parameterized queries, placeholder syntax per database (PostgreSQL vs. MySQL/SQLite), and best practices around parameterization. This adds practical semantics beyond 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?

The description opens with a clear action: 'Execute a SQL query against a database connection.' It explicitly lists supported statement types (SELECT, INSERT, UPDATE, DELETE) and differentiates from siblings by directing schema exploration to whodb_schemas, whodb_tables, and whodb_columns. This is a specific verb+resource with clear scoping.

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 'Best for' and 'Not recommended for' sections provide explicit guidance on when to use this tool versus sibling tools, naming alternatives directly. 'Common mistakes' further clarifies safe usage (e.g., specifying connection, using LIMIT). This is exemplary usage guidance.

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