Skip to main content
Glama
nichuan

sql-template-mcp

by nichuan

search_sql_template

Retrieve reusable SQL templates by keyword or natural language, filtered by document type, category, or verified status. Combines semantic and keyword search to return SQL snippets with verification status.

Instructions

在模板库中检索可复用的 SQL 模板(生成 SQL 前先调用,形成闭环)。

采用混合检索:语义向量召回(NVIDIA Embedding) + 关键词模糊匹配,按相似度/使用次数综合排序。 若未配置 NVIDIA_API_KEY,自动降级为纯关键词检索,不影响原有能力。

参数:

  • keyword: 关键词或自然语言描述(如「把询价单退回到报价中」「ssrc_rfx_header」)

  • doc_type: 按单据类型过滤(通用/询价单/招标单/征询单/数据修复)

  • category: 按业务分类过滤(通用基础查询/询价单RFX/征询单RF/数据修复)

  • verified_only: 仅返回「✅ 已验证」模板

  • limit: 返回条数上限

  • use_semantic: 是否启用语义召回(默认 true;无 NVIDIA key 时自动忽略)

返回:匹配模板的 Markdown 列表(含 SQL 与验证状态,语义命中会标注相似度)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
keywordNo
categoryNo
doc_typeNo
use_semanticNo
verified_onlyNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations provided, the description carries the full burden and does so well. It discloses the hybrid retrieval mechanism, fallback behavior without NVIDIA_API_KEY, sorting criteria (similarity/usage count), and return format (Markdown list with SQL, verification status, and similarity scores). This is rich behavioral context beyond what structured fields provide.

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 a clear purpose statement, retrieval behavior summary, and a bulleted parameter list. It is appropriately sized for a tool with six parameters and zero schema coverage; every sentence adds value without redundancy.

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 (6 parameters, hybrid retrieval, fallback logic) and the lack of annotations, the description is complete. It covers when to use it, how retrieval works, all parameter semantics, and the return format. The presence of sibling tools does not create gaps because the description clearly positions this as the hybrid search entry point.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate, and it does. It explains all six parameters with concrete examples (e.g., keyword examples like 「把询价单退回到报价中」), enumerates doc_type and category options, and clarifies use_semantic's default and fallback behavior. This adds substantial meaning beyond the bare input 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 clearly states the tool retrieves reusable SQL templates from a template library and should be called before generating SQL. It distinguishes itself by specifying a hybrid retrieval approach (semantic vector + keyword fuzzy matching), which differentiates it from siblings like semantic_search_sql_template and list_sql_templates.

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?

The description provides a clear usage context: call before generating SQL to form a closed loop. It also explains the automatic fallback when NVIDIA_API_KEY is not configured. However, it does not explicitly name alternative tools or state when not to use this tool versus its siblings.

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/nichuan/sql-template-mcp'

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