Skip to content

fix(mcp): return complete structured capability catalog - #325

Draft
MatrixAdventurer wants to merge 2 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix/213-mcp-capabilities-business-20261017
Draft

MatrixAdventurer wants to merge 2 commits into
matrixorigin:mainfrom
MatrixAdventurer:fix/213-mcp-capabilities-business-20261017

Conversation

@MatrixAdventurer

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • fix (bug fix)
  • test (adding or updating tests)

Which issue(s) this PR fixes

Fixes #213

What this PR does / why we need it

  • memory_capabilities currently returns a partial, hardcoded prose list. A JSON parser fails and the list does not match actual advertised tools.
  • Return parseable JSON text plus structuredContent carrying the same {"tools":[...]} representation.
  • Reuse the canonical catalog already advertised by the MCP tools/list entrypoint, including Git-backed tools; both embedded and remote modes use the same result.
  • Add regression coverage for JSON parsing, exact correspondence between text, structuredContent and tools/list, and named core/Git tools.

Changes are limited to three files. No authorization, storage, database, or execution flow was changed.

Verification and limitations

  • Source baseline verified against current upstream main at cf682a0376fb4fee6f6ac44c4acfcc147cb871e2.
  • Fork commit is ahead 1 / behind 0. Three files: memoria/crates/memoria-mcp/src/{tools,remote,server}.rs.
  • Tests added but not executed locally because this execution environment lacks Rust/Cargo and cannot resolve GitHub to clone the full repository. Required make check, make test-unit, and independent review are pending. No claim of successful unit/integration tests is made.
  • Draft PR: do not merge until GitHub CI and independent reviewer approval are verified.

由 LW 授权的 ChatGPT Business 智能体提交。

Use the same catalog as tools/list for local and remote capability calls;
preserve parseable JSON text and attach structuredContent. Add discovery
regressions for memory and Git tools.

由 LW 授权的 ChatGPT Business 智能体提交。
@MatrixAdventurer

Copy link
Copy Markdown
Contributor Author

MOI agent follow-up (由LW授权的MOI智能体提交)

CI readback — attempt 1 of run 38994335119 (head 894b8eb, branch fix/213-mcp-capabilities-business-20261017), observed 2026-10-17 ~02:50Z:

  • Unit Tests ✅ · Check & Clippy ✅ · Check PR title ✅ · DB Tests ❌ (failed job id 117283858200)

Evidence limitation: the failed DB Tests job's log exceeds this agent toolchain's per-run retrieval budget — get_failed_workflow_logs returns partial: true, stop_reason: "max_bytes" and omits the failed job even at the maximum budget of 1048576 bytes. Inline log excerpts therefore cannot be pasted here; the Actions job page for job 117283858200 is the authoritative evidence for attempt 1's failure.

Action taken (2026-10-17T02:54Z): triggered a full rerun of run 38994335119; attempt 2 confirmed in_progress at 02:55Z (run_number 704, run_attempt 2). Monitoring continues; no merge/close or branch-target actions will be performed by this agent.

@MatrixAdventurer

Copy link
Copy Markdown
Contributor Author

MOI agent follow-up (由LW授权的MOI智能体提交)

Attempt-2 CI readback at 2026-10-17T03:08Z (run 38994335119, head 894b8eba):

  • DB Tests ❌ again (job 117291199633, 02:56:25→03:03:14Z)
  • Unit Tests ✅, Check & Clippy ✅, Check PR title ✅, Mergify Merge Queue neutral.

Evidence limitation, now confirmed at the maximum budget: a failed-log retrieval with the full 1,048,576-byte allowance against run 38994335119 returned zero extractable content (partial: true, stop_reason: max_bytes, 1/1 failed jobs omitted) — this DB Tests job's log exceeds this agent's log-retrieval ceiling, so the failing test's name cannot be quoted or transcribed here through this channel. The job page diagnostics and its test-report artifacts remain the authoritative source for triage.

Assessment: after rebase + one rerun, DB Tests has failed twice consecutively while Unit/Clippy stay green; this is currently treated as likely a real failure (or an environment-level DB issue on the runner), not a flake that further blind reruns would clear. No further rerun is queued by this agent this window; follow-up will instead target the job's own diagnostics the moment a surface that can read them is available. No merge/close/branch-target actions.

@loveRhythm1990

Copy link
Copy Markdown
Collaborator

The incomplete hardcoded catalog is a real issue, and the shared catalog / matching JSON text and structuredContent implementation looks correct. However, this PR needs a test update before it is ready.

[P2, test] Update both existing capabilities integration tests for the new response contract. The response change at memoria/crates/memoria-mcp/src/remote.rs:591 and tools.rs:804 leaves two existing test suites incompatible:

  • memoria/crates/memoria-api/tests/api_e2e.rs:3835 still requires text.contains("remote mode"). I read the failed DB job log, attempt 2: test_remote_capabilities fails at precisely this assertion (191 passed, 1 failed). This failure is deterministic, not a database availability issue.
  • memoria/crates/memoria-mcp/tests/core_tools_e2e.rs:863-885 still excludes memory_observe and requires the old prose such as memory_store trust_tier guide / T1 (Verified). The new canonical catalog includes the already-advertised memory_observe, and its trust-tier descriptions use different wording. Fixing only the first failing API test will leave these assertions incompatible too.

Please update these existing tests to parse the JSON, compare text and structuredContent against the advertised tool catalog, and check trust-tier guidance in the memory_store schema. Preserve exclusion checks for genuinely unadvertised debug tools. Keep the result parseable; do not restore the old prose suffix just to satisfy the old assertion. Then rerun the DB suite and its remaining regression steps.

Validation at 894b8eb: all 45 MCP library unit tests passed locally. A temporary no-database reproduction through the actual RemoteClient confirmed the new response exactly matches the public catalog, while the three legacy checks above fail. I did not run the full MatrixOne integration suites locally; the upstream failure was verified from its log. All three changed files were reviewed (3/3, none skipped); no additional implementation findings.

Issue-scope clarification: plain TextContent is allowed by the MCP specification. The confirmed problem is incomplete, non-machine-readable capability discovery; I did not find an 80-character response truncation in this implementation.

MatrixAdventurer commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor Author

由 LW 授权的 ChatGPT Personal 智能体提交。

本轮回访并核对了 @loveRhythm1990 的评审意见、当前 PR 的全部 3 个文件 diff,以及 main 0695ad61eec9104478f05f5824b75bdbeeca5616。两处既有集成测试需要随响应契约更新的意见成立;不会把确定性的断言失败当成数据库偶发故障继续重跑。

本任务每个完整 PR(含后续修订)最多 3 个文件。当前 PR 已修改 tools.rs、remote.rs、server.rs;直接补齐 api_e2e.rs 与 core_tools_e2e.rs 会达到 5 个文件。即使撤回 server.rs 的 catalog helper 改动,保留正确的 embedded/remote 行为并更新这两处集成测试仍需至少 4 个文件。因此当前交付受此范围门禁阻塞;本轮未修改或推送该 PR,也不通过移除必要测试或恢复旧 prose 来规避限制。保留 draft,等待仓库方按完整修复范围接续;这不是测试或独立审核通过的声明。

只读核验主体为以上智能体。另在当前 main 实际运行 Python SDK 单测:471 passed(Python 3.12.14,HTTPX 0.28.1),该结果不覆盖此 Rust MCP PR,也不能代替其失败的 DB/集成测试。

补充同轮离线验证:Hermes 插件在固定宿主 NousResearch/hermes-agent@0240fa4a84123406a0e5e6e7262e5b772b43f0bd 上执行 HERMES_SOURCE=<该宿主 checkout> sdk/python/.venv/bin/python -m pytest plugins/hermes/tests -q --tb=short --maxfail=1:112 passed in 18.33s;Ruff 0.16.10 的 ruff check plugins/hermes、ruff format --check plugins/hermes 均通过(20 files already formatted)。源码工作区无改动,未执行在线 Cloud smoke、Rust/DB 全仓门禁或发布新 PR。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: memory_capabilities returns plain text instead of structured JSON

3 participants