Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[Bug]: MCP orderby takes incompatible shapes in read_records and aggregate_records, and the mismatch returns an opaque UnexpectedError

已关闭
#3,810 1 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@aaronburtle 已经在做这个了。

开始于 2026年9月14日。

评估

这个 Issue 还没有评估数据。

描述

mcp-server
What happened?

The two MCP DML tools accept orderby in mutually incompatible shapes. Passing one tool's shape to the other returns UnexpectedError with no indication of what was wrong, so the caller has no way to discover the correct form from the error.

aggregate_records expects a bare direction string. It sorts by the aggregated value.

argument result
orderby: "desc" OK, groups sorted by aggregated value descending
orderby: "asc" OK
orderby: "COLUMN_NAME" InvalidArguments: Argument 'orderby' must be either 'asc' or 'desc' when provided. Got: 'COLUMN_NAME'. — clear and actionable
orderby: ["desc"] UnexpectedError: Unexpected error occurred in AggregateRecordsTool. — opaque

read_records expects an array of column specifications.

argument result
orderby: ["COLUMN_NAME desc"] OK
orderby: "COLUMN_NAME desc" UnexpectedError: Unexpected error occurred in ReadRecordsTool. — opaque
orderby: "COLUMN_NAME" same

So the shape that is correct in one tool is an opaque failure in the other, in both directions.

Why this matters more for MCP than for REST

The consumer is a language model reading describe_entities output and the tool input schemas. Having learned ["COLUMN desc"] from read_records, it will use that in aggregate_records and get a failure that names neither the parameter nor the expected form. There is no discovery path from the error back to the working call.

Asks
  1. Return an actionable message for the shape mismatch in both tools, as aggregate_records already does for the column-name case. Naming the expected shape would be enough.
  2. Consider accepting both shapes, or aligning them.
Two related observations

aggregate_records silently ignores orderby when groupby is absent, rather than rejecting it. A caller asking for sorted output gets unsorted output and a success response.

Grouped results are returned ordered by the aggregated value, and there is no way to order by the group key, because orderby accepts only a direction. For a groupby on a date or period column this means the caller cannot ask for chronological order and has to sort client-side. Given that filtering on a date-typed column is currently broken (#3760), groupby on the date is the only way to reach a single period, which makes the inability to order by that key more limiting than it would otherwise be.

Version

2.1.3-rc

What database are you using?

Azure SQL

What hosting model are you using?

Azure Container Apps

Which API approach are you accessing DAB through?

MCP

主要语言
C#
星标
1.5k
派生
371
平均合并
9 天 2 小时
30 天内合并 PR
10

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

Azure/data-api-builder 的其他 Issue

查看 Azure/data-api-builder 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。