Skip to content

fix(mcp): expose wiki output in structured content - #3590

Merged
lyingbug merged 1 commit into
Tencent:mainfrom
dvd233:contrib/issue-3575-wiki-structured-content
Sep 24, 2026
Merged

lyingbug merged 1 commit into
Tencent:mainfrom
dvd233:contrib/issue-3575-wiki-structured-content

Conversation

@dvd233

@dvd233 dvd233 commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Description

MCP clients that only inspect structuredContent currently receive Wiki routing metadata but not the page/search body. The Wiki MCP handlers pass the body only as the text fallback while Data contains only metadata.

This change adds the human-readable tool output as Data["content"] for wiki_search and wiki_read_page before the existing MCP conversion. It intentionally leaves the shared converter and other tools unchanged, avoiding a payload change for search_knowledge/read_document.

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 💥 Breaking change
  • 📚 Documentation update
  • 🎨 Refactor
  • ⚡ Performance improvement
  • 🧪 Test
  • 🔧 Configuration / Build / CI

Related Issue

Fixes #3575

Testing

  • go test ./internal/mcpserver -count=1
  • go vet ./internal/mcpserver
  • golangci-lint run --new-from-rev=origin/main ./internal/mcpserver
  • gofmt -l internal/mcpserver/tools_wiki.go internal/mcpserver/tools_wiki_test.go
  • git diff --check

The focused test covers existing metadata preservation, nil structured data, existing content preservation, unsuccessful/empty results, the in-memory MCP result, and its JSON wire representation.

The full-repository lint/test gate was not claimed because this Windows environment lacks the repository's required native prerequisites: full lint type-checking cannot find sqlite3.h, and internal/agent/tools cannot link the prebuilt DuckDB C++ archive with the available MinGW runtime. These failures are outside the changed package; the focused package checks pass.

Checklist

  • git diff --check origin/main...HEAD passes
  • Changed source files are formatted
  • Targeted tests for the changed packages/components pass
  • Diff-scoped lint passes where applicable
  • Full-repository checks were run, or unrelated/environment-dependent failures are documented above
  • Self-reviewed the code
  • Added/updated tests covering the change
  • Updated related documentation (not needed; no public API docs changed)
  • Breaking changes are clearly called out (none)

Screenshots / Recordings

Not applicable; this is an MCP response compatibility fix with no UI change.

Copilot AI lite review requested due to automatic review settings September 22, 2026 17:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@lyingbug
lyingbug merged commit e87607e into Tencent:main Sep 24, 2026
1 check passed
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]: MCP 的 wiki_read_page / wiki_search 在只读 structuredContent 的客户端上拿不到页面正文

3 participants