check_index_coverage: tools/list schema omits that at least one non-empty paths or scopes array is required

未关闭 适合新手
#3,130 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
c
领域
api

调研方向

阅读 src/mcp/mcp.c:800-814 中的工具 schema 和 src/mcp/mcp.c:7594-7603 中的验证逻辑。检查 check_index_coverage 的描述和输入 schema 是如何组装的,然后将它们与运行时要求进行比较:paths 或 scopes 必须非空。当发布的 schema 或描述传达了与运行时验证相同的要求时,即为完成。

由索引模型根据 Issue 内容生成。

描述

editor/integration
Version

v0.12.1 (built from source at commit 9a4da7a3; also verified unchanged on main d5e39e5a)

Platform

Linux (x64)

Install channel

Built from source

Binary variant

standard

What happened, and what did you expect?

Calling check_index_coverage with only the required project argument (e.g., {"project": "demo"}) — or with empty arrays {"project": "demo", "paths": []} — is completely valid according to the MCP tools/list schema and tool description, but handle_check_index_coverage rejects the call at runtime with isError: true:

paths or scopes is required (arrays; max 128 paths and 32 scopes)

In src/mcp/mcp.c:800-814 (main d5e39e5a), the published tool schema only marks project as required, gives paths and scopes neither description nor minItems, and the tool description does not mention that at least one non-empty paths or scopes array must be supplied:

{
  "name": "check_index_coverage",
  "description": "Best-effort exact-path/scope coverage and freshness, paged separately. full diagnostics adds raw detail. Clean is not proof of completeness.",
  "inputSchema": {
    "type": "object",
    "properties": {
      "project": { "type": "string" },
      "paths": { "type": "array", "items": { "type": "string" }, "maxItems": 128 },
      "scopes": { "type": "array", "items": { "type": "string" }, "maxItems": 32 },
      "...": "..."
    },
    "required": ["project"]
  }
}

Meanwhile handle_check_index_coverage (src/mcp/mcp.c:7594-7603) enforces (path_count == 0U && scope_count == 0U) and immediately returns an error.

Expected: The MCP tools/list description and/or inputSchema should clearly declare this precondition (for example, noting in the description that at least one non-empty paths or scopes array is required, and/or adding minItems: 1 / anyOf constraints) so MCP clients/agents do not construct schema-valid calls that fail at runtime.

Reproduction
  1. Dummy repository (/tmp/cbm-repro with one file app.py):

    def hello() -> str:
        return "ok"
    
  2. Index the repository, then call check_index_coverage with only the schema-required project field (via MCP tools/call or CLI):

    codebase-memory-mcp cli index_repository '{"repo_path":"/tmp/cbm-repro","name":"demo"}'
    codebase-memory-mcp cli check_index_coverage '{"project":"demo"}'
    
  3. Actual result: isError: true

    paths or scopes is required (arrays; max 128 paths and 32 scopes)
    

    (Passing {"project":"demo","paths":["app.py"]} succeeds and returns signal: best_effort.)

    Expected result: Either the tools/list schema/description documents that at least one non-empty paths or scopes array is required (matching src/mcp/mcp.c:7594-7603), or omitting both defaults to a valid project-level response.

Logs
No stderr errors; deterministic MCP tool error returned on stdout:
paths or scopes is required (arrays; max 128 paths and 32 scopes)
Diagnostics trajectory (memory / performance / leak issues)

N/A (MCP schema / validation mismatch, not a memory or performance issue).

Project scale (if relevant)

1 file / minimal dummy snippet

Confirmations
  • I searched existing issues and this is not a duplicate.
  • My reproduction uses shareable code (a dummy snippet or a public OSS repository), not proprietary code.
主要语言
C
星标
45.8k
派生
3.8k
平均合并
2 天 15 小时
30 天内合并 PR
90

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

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

DeusData/codebase-memory-mcp 的其他 Issue

查看 DeusData/codebase-memory-mcp 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

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