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

`describe_entities` should merge config fields with DB columns for tables/views

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

这个 Issue 还没有评估数据。

描述

2.x mcp-server

Summary

For stored-procedure entities, describe_entities now uses the database as the source of truth for parameters and treats config as an overlay (#3400). The same merge does not yet happen for tables and views: the fields array surfaced to MCP agents comes from entity.Fields in config alone, and the database columns are ignored.

Why this matters

Most users do not list every column under entities.<entity>.fields in config — that block is typically used only when a column needs an alias, a description, or a primaryKey override. As a result, today:

  • A table or view entity with no fields: block in config emits an empty fields array to MCP agents. The agent has no way to see what columns the entity actually has.
  • A table or view entity with a partial fields: block (e.g. only one column described for an alias) emits only that column — the rest of the table is hidden from the agent.

This is the same class of agent-can't-see-required-inputs bug that #3400 fixed for stored-procedure parameters.

Where the gap lives

DescribeEntitiesTool.BuildFieldMetadataInfo:

private static List<object> BuildFieldMetadataInfo(List<FieldMetadata>? fields)
{
    List<object> result = new();
    if (fields != null)
    {
        foreach (FieldMetadata field in fields)
        {
            result.Add(new
            {
                name = field.Alias ?? field.Name,
                description = field.Description ?? string.Empty
            });
        }
    }
    return result;
}

The DB-side equivalent lives at SourceDefinition.Columns (a Dictionary<string, ColumnDefinition>) on the resolved DatabaseObject — same access pattern the SP parameter merge uses.

Proposed merge rules (mirroring #3400)

For table and view entities:

  • name: from DB (Columns.Keys); config Alias overrides for the surfaced name.
  • description: config-only (no reliable DB-side column description in MSSQL/PostgreSQL/MySQL metadata).
  • primaryKey: from DB (SourceDefinition.PrimaryKey); config PrimaryKey overrides if present.
  • (Optional) type info: surface ColumnDefinition.SystemType / DbType so agents know the column shape.
  • DB columns not listed in config are still surfaced (with no alias/description) so agents see the full schema.
  • Fall back to emitting config fields as-is when DB metadata is unavailable (same degraded path as the SP parameter merge).

Acceptance criteria

  • Tables and views with no fields: config block surface all DB columns to describe_entities.
  • Config Alias, Description, and PrimaryKey overlay correctly when present.
  • DB columns not listed in config are still surfaced.
  • Degraded fallback: when DB metadata is unavailable, config-declared fields are emitted as-is.
  • Unit tests mirror the SP parameter merge tests in DescribeEntitiesStoredProcedureParametersTests.

Related

  • #3400 — original SP parameter merge issue
  • PR #_____ — SP parameter merge implementation (introduced McpMetadataHelper.TryResolveDatabaseObject, which this work can reuse)
主要语言
C#
星标
1.5k
派生
372
平均合并
9 天 1 小时
30 天内合并 PR
13

环境准备

从这里开始

  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 摘要。