Static source inference · medium confidence · detected: Logging
Deprecated protocol patterns detected
Summary
This server provides 4 tools for ClickHouse database interaction. Tool naming follows good conventions (verb_noun pattern: list_databases, list_tables, run_select_query, run_chdb_select_query). However, definitions are inconsistent: list_tables has solid schema and description, but run_select_query and run_chdb_select_query lack depth. Critically, output schemas are not documented for any tool, the code returns JSON but LLMs cannot see the structure ahead of time. Error handling via ToolError exists but lacks guidance on recovery. No parameter validation constraints (enums, ranges) are declared. The server does not expose secrets as parameters (good), but composition is limited, tools are read-only and narrowly scoped without idempotency or batch variants.
Tools (4)
list_databasesread onlysource verified63/100
List available ClickHouse databases
list_tablesread onlysource verified70/100
List available ClickHouse tables in a database, including schema, comment, row count, and column count.
Output schemas not documented. Tools return JSON (columns + rows or database/table lists) but LLMs cannot see the response structure in advance. This violates the requirement that 'LLMs need to know what fields to expect so they can plan downstream tool calls and extract the right data.'
run_select_query and run_chdb_select_query descriptions are vague. 'Run a SELECT query in a ClickHouse database' does not answer: when to use this vs list_tables? What does it return? Are there limits? Without clarity, LLMs may misselect tools or fail to compose them correctly.
No result limits or pagination declared. list_tables and run_select_query can return unbounded result sets. Code does not show limit enforcement or pagination support (no page/offset/limit parameters visible). Large result sets will exhaust context and degrade LLM reasoning.
list_tables
Recommendations
Add explicit output schemas to each tool definition. Example: 'Returns: {"columns": [string], "rows": [array], "total_count": number, "next_cursor": string|null}' or for list_tables: '{"tables": [{"name": string, "engine": string, "total_rows": number, "comment": string|null, "columns": [...]}], "count": number}'.
Expand run_select_query and run_chdb_select_query descriptions to clarify scope and differentiation. E.g.: 'Execute arbitrary SELECT queries against ClickHouse. Returns rows and column metadata. Queries must be SELECT-only (no INSERT/UPDATE/DELETE). Max 10,000 rows per call, use list_tables for schema discovery.' Add warning about timeout (SELECT_QUERY_TIMEOUT_SECS = 30).
Implement and document pagination. Add parameters: limit (1-1000, default 100), offset (default 0). Return total_count and has_more. Update description: 'Paginates results in batches to avoid context overflow.'
Add result limits enforcement to code and describe in docs. Cap list_tables and run_select_query at 100-1000 rows by default. Return error: 'Query returned 15,000 rows; max is 1000. Use LIMIT clause or list_tables pattern parameter to refine.' This prevents context explosion.
Enhance error messages with recovery hints. Replace 'Query execution failed: <raw error>' with: 'Query execution failed: <parsed error reason>. <suggestion>.' Example: 'Column not found: "user_nam" (did you mean: user_name, user_email)?' or 'Timeout after 30s. Try: add LIMIT 1000 to the query.'
Document like/not_like parameter syntax explicitly. Add to description: 'Pattern uses SQL LIKE syntax: % matches any substring, _ matches single char. Case-insensitive. Example: "user%" matches "user", "users", "user_table".'
Spec posture evidence
Inferred effective spec: <=2025-11-25.
Relies on Logging (deprecated) - log to stderr or use OpenTelemetry
Error messages lack recovery guidance. ToolError is raised with a message (e.g. 'Query execution failed: ...') but does not tell the LLM what to do next. Per pattern:recovery-guide, errors should guide the agent: 'Invalid query syntax. Try: SELECT column FROM table WHERE ...' or 'Connection timeout. Retry in 5 seconds.'
list_tables 'like' and 'not_like' parameters lack format guidance. Descriptions say 'Optional pattern to filter tables by name (LIKE clause)' but do not explain: SQL LIKE syntax (% and _)? Regex? Case sensitivity? LLMs may pass invalid patterns that fail silently.
No tool annotations (readOnlyHint, idempotentHint, destructiveHint) visible in code. Fastmcp may support these, but none are declared. This leaves the LLM without explicit guidance on whether tools are safe to retry or read-only.
Add tool annotations via fastmcp (readOnlyHint=true for all tools, idempotentHint=true for list_* and run_select_query). This signals to LLMs that tools are safe to retry.
Add query validation examples in descriptions. E.g. for run_select_query: 'Only SELECT queries allowed. Mutations (INSERT, UPDATE, DELETE) rejected. Queries longer than 50KB rejected.'
Consider adding a 'explain_query' tool or parameter to run_select_query. This would help agents understand query costs and validate syntax before execution, reducing failed calls.
Return full chain-required IDs. If list_tables returns table names, ensure they include database name for downstream queries. Currently table.name alone may not be unique across databases, LLMs need (database, table) pairs to compose follow-up queries correctly.