Skip to main content
Glama
clidey

whodb-cli

Official

whodb_query

Run SQL queries against a database connection. Use parameterized queries for safe execution 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 annotations (destructiveHint: false), the description discloses the confirmation mechanism for write operations, including the token flow, which adds essential 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.

Conciseness5/5

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

The description is well-structured with sections, bullet points, and examples. Every part adds value, and the most critical information (purpose, guidelines) is front-loaded.

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 complexity (SQL execution, security, multiple DB flavors), the description covers common mistakes, best practices, security flow, and example usage, 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?

Input schema covers all 3 parameters with descriptions. The description adds additional context via usage examples, placeholder syntax per database, and best practices (parameterized queries), going 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 explicitly states it executes SQL queries (SELECT, INSERT, UPDATE, DELETE) against a database connection, and distinguishes from sibling tools like whodb_schemas, whodb_tables, whodb_columns for schema exploration.

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?

Provides explicit when-to-use and when-not-to-use guidance, citing specific alternatives, and lists common mistakes to avoid.

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