Details
-
Bug
-
Resolution: Unresolved
-
Major
-
None
-
0.9
-
None
-
Medium
-
Description
Problem
The write_document MCP tool tells clients to generate XWiki 2.1 content, but it does not set the document syntax when creating a page. The new page inherits the wiki default syntax.
On a wiki configured to use markdown/1.2 by default, XWiki 2.1 content can therefore be stored as Markdown and rendered incorrectly.
Observed with XWiki 18.4.4 and LLM MCP extension 0.9.
Source
Repository: xwiki-contrib/ai-llm
Input schema and instructions (the line that causes the bug): MCPWriteDocumentTool.java lines 169-189
.description("... Write XWiki 2.1 syntax, NOT Markdown ...")
Proposed behavior
- Add an optional syntax parameter to write_document. The parameter identifies both the syntax of content and the syntax assigned to a newly created document.
- Extend list_wikis to report the current default document syntax of every reachable wiki.
- When creating a document:
- If syntax is supplied, validate it and assign it to the new document.
- If syntax is omitted, resolve the target wiki's default syntax dynamically at execution time and use it.
- Update the write_document instructions to tell clients to consult list_wikis before generating content when syntax is omitted. Do not hardcode XWiki 2.1 or any other syntax.
- When updating an existing document:
- Preserve its current syntax when syntax is omitted.
- Reject the operation when the supplied syntax differs from the document's current syntax.
- Report the effective document syntax in every successful write_document response.
- Update the tool schemas, man pages and tests, including single-wiki and cross-wiki cases.