Skip to main content
Glama
nichuan

sql-template-mcp

by nichuan

semantic_search_sql_template

Find SQL templates by semantic meaning. Enter a natural-language query to retrieve relevant templates ranked by similarity, with optional filters for doc type, category, and verified status.

Instructions

用语义向量召回模板,适合自然语言/口语化描述(如同义改写、业务意图)。

底层调用 schema.sql 的 match_sql_templates RPC(pgvector 余弦距离)。 需配置 NVIDIA_API_KEY;未配置或调用失败时返回降级提示。

参数:

  • query: 自然语言查询(如「把询价单退回到报价中状态」「查某供应商名下所有在执行的招标单」)

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

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

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

  • threshold: 相似度阈值(0~1,越高越严格,默认 0.5)

  • limit: 返回条数上限

返回:按语义相似度排序的模板 Markdown 列表(含相似度分值)。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo
queryYes
categoryNo
doc_typeNo
thresholdNo
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, the description carries the full burden and does a thorough job: it discloses the underlying match_sql_templates RPC, pgvector cosine distance, the NVIDIA_API_KEY requirement, the degradation behavior when the key is missing or the call fails, and the sorted Markdown return format. This goes well beyond a generic search description.

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 compact and well-structured: a one-sentence purpose, a short implementation/prerequisite note, a clean parameter list with human explanations, and a one-line return summary. Every element earns its place; no filler or 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 six parameters, no annotations, and only an empty schema description, this tool's description is complete: it covers purpose, computational model, configuration prerequisite, failure behavior, parameter semantics, and return format. The presence of an output schema further reduces the need to explain return structure, but the description adds the useful Markdown/similarity-score detail.

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%, and the description compensates fully by explaining all six parameters: query with concrete business examples, permitted doc_type/category values, verified_only filtering, threshold range with default, and limit. This adds substantial meaning beyond the raw 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?

Description opens with a specific verb+resource: '用语义向量召回模板' and states it suits natural-language/paraphrased queries such as '把询价单退回到报价中状态'. This semantic-search scope clearly distinguishes it from sibling tools like search_sql_template.

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?

It gives clear usage context: use for natural language/口语化 descriptions and semantic similarity, and it lists the prerequisite NVIDIA_API_KEY plus fallback behavior. It does not explicitly name alternatives or say 'do not use for exact keyword matching', but the suitability framing is enough.

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