Skip to main content
Glama

smart_query

Read-only

Translates natural-language questions into SQL queries by analyzing schema, matching examples, and requesting clarification for ambiguous inputs.

Instructions

BIRD SQL-based intelligent query tool. Analyzes natural-language questions to (1) extract relevant schema, (2) match similar few-shot examples, (3) assess complexity, (4) request clarification for ambiguous questions. Call this tool before run_query. For a new data source, first inspect the schema with list_tables, then register keyword-to-table mappings via manage_keyword_map to significantly improve accuracy. Note: when ANTHROPIC_API_KEY is set, table-name lists (never query results or row data) may be sent to the Anthropic API as a fallback for table selection.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
data_source_idYesData source ID (from list_data_sources)
questionYesNatural-language question (e.g., 'How many payments were completed last month?')
contextNoUser's answer to a previous clarification question (for multi-turn)
Behavior5/5

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

Discloses that table-name lists may be sent to Anthropic API under certain conditions, clarifies no query results are sent, and explains the multi-turn context usage. This adds value beyond the readOnlyHint annotation and builds trust.

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 a single focused paragraph with no wasted sentences. It front-loads the purpose and steps. Slightly dense but efficient for the complexity.

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 of the tool (multi-step analysis, external API fallback, preconditions), the description covers all key aspects: steps, prerequisites, fallback behavior, and interaction with other tools. It is complete for an agent to understand how to use it effectively.

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?

Schema coverage is 100%, so baseline is 3. The description adds meaningful context for the 'context' parameter ('user's answer to a previous clarification question for multi-turn'), which goes beyond the schema's brief description.

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 identifies the tool as an intelligent NL-to-SQL pre-processor that extracts schema, matches examples, assesses complexity, and requests clarification. It distinguishes from sibling tools like run_query and list_tables by positioning itself as a prerequisite step.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly states 'Call this tool before run_query' and provides guidance to first inspect schema and register keyword mappings for new data sources. However, it does not explicitly state when not 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/seob717/redash-mcp'

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