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, for example markdown/1.2.
- When creating a document:
- Use the supplied syntax, when present.
- Otherwise, obtain the target wiki's default dynamically through XWiki#getDefaultDocumentSyntax().
- Advertise the effective default syntax dynamically in the tool description or man page instead of hardcoding XWiki 2.1.
- When updating a document, preserve its existing syntax and reject a supplied syntax that differs from it.
- Update the tool schema, documentation and tests.
|