arXiv:2608.22063cs.AIcs.DB2026-08

用领域工具替代实时生成SQL,让小模型也能高效处理企业数据查询。

From SQL Generation to Tool Selection: A Domain-Oriented Pattern for MCP Servers

论文配图:From SQL Generation to Tool Selection: A Domain-Oriented Pattern for MCP Servers
图 1 · 摘自论文原文
  • 模型不再现场写SQL,而是从预定义的领域工具中选合适指令。
  • 小模型(3B)在垂直化工具包下准确率提升至0.929,比原始方案高近1倍。
  • 适合想降低大模型依赖、提升查询效率的企业级AI应用开发者。

基于大语言模型的智能体通过模型上下文协议(MCP)访问企业数据,当前多数MCP数据库服务器采用单一通用SQL执行工具以保持灵活性。本文提出领域导向工具模式:不现场生成SQL,而是在服务端预先封装好包含模式导航、表连接和业务规则的参数化查询,由模型选择对应领域工具。该模式围绕三项架构不变性构建,并发现模型降级现象——将SQL生成替换为意图分类后,可降低对模型规模的要求。作为参考实现,我们推出开源框架MCP Blueprint,通过YAML元数据和外部参数化SQL文件声明领域工具。我们在萨基拉(Sakila)数据库上评估三种设计:直接执行SQL、轻量通用工具包、垂直化领域工具包,使用四个本地模型(3B-8B)在17个客户任务上进行测试(共609次有效计算,温度0,每组重复3次)。结果表明,垂直化工具包平均得分0.939,远超原始方案(0.666)与通用工具包(0.605);最小模型得分从0.583跃升至0.929,达到甚至超越更大模型表现,且单位正确答案成本降低一个数量级。所有测试代码、提示、标准答案、冻结工具包及每项结果均公开可用。

原文摘要 · Abstract (English)

Agents built on Large Language Models (LLMs) increasingly reach enterprise data through the Model Context Protocol (MCP), and many MCP database servers maximize flexibility by exposing a single generic SQL execution tool. This paper proposes the Domain-Oriented Tooling Pattern: instead of generating SQL at query time, the model selects from a small set of domain-aligned tools whose parameterized queries encapsulate schema navigation, joins and business rules on the server side. We formalize the pattern around three architectural invariants and introduce Model Demotion, the observation that replacing SQL synthesis with intent classification lowers the model tier required to serve routine requests. As a reference implementation we present MCP Blueprint, an open-source framework in which domain tools are defined declaratively as YAML metadata plus external parameterized SQL files. We evaluate the pattern with a public reproducibility benchmark comparing three MCP server designs - raw SQL execution, a thin generic tool pack, and a verticalized domain pack - on four local models (3B-8B) across seventeen customer-facing tasks over the Sakila database (609 completed cells; temperature 0; three repetitions per cell). The verticalized pack reaches a pooled mean score of 0.939 versus 0.666 for raw SQL and 0.605 for the generic pack; the smallest model improves from 0.583 to 0.929, matching or exceeding every larger configuration while cutting cost per correct answer by an order of magnitude. All harness code, prompts, gold answers, frozen packs and per-cell results are publicly available.

MCPSQL生成工具选择低资源推理

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。