There are 2 updates.
 
 
LLM AI Integration / cid:jira-generated-image-avatar-5c8ad7f2-ede7-43d1-8d90-5d7b871855f5 LLMAI-180 Open

MCP write_document hardcodes XWiki 2.1 syntax but new pages inherit the default wiki syntax

 
View issue   ยท   Add comment
 

2 updates

 
cid:jira-generated-image-avatar-a6a41076-bf6a-4a17-9f7b-a4e89a558d73 Changes by Enrique on 01/Sep/26 13:53
 
Difficulty: Easy Medium
Description: h3. 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.
h3. Source

*Repository:* [xwiki-contrib/ai-llm|https://github.com/xwiki-contrib/ai-llm]
*Input schema and instructions (the line that causes the bug):* [MCPWriteDocumentTool.java lines 169-189|https://github.com/xwiki-contrib/ai-llm/blob/03acda44a804196ce618c17652f5db520b4e5ebe/application-ai-llm-mcp/application-ai-llm-mcp-server/src/main/java/org/xwiki/contrib/llm/mcp/internal/MCPWriteDocumentTool.java#L169-L189]
{code:java}
.description("... Write XWiki 2.1 syntax, NOT Markdown ...")
{code}

h3. Proposed behavior

* Add an optional {{syntax}} parameter
, for example to {{ markdown/1 write_document}} . 2 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:
**
Use the supplied If {{syntax}} is supplied , when present validate it and assign it to the new document .
**
Otherwise If {{syntax}} is omitted , obtain resolve the target wiki's default syntax dynamically through {{XWiki#getDefaultDocumentSyntax()}} at execution time and use it .
*
Advertise Update the effective default {{write_document}} instructions to tell clients to consult {{list_wikis}} before generating content when {{ syntax dynamically in the tool description or man page instead of hardcoding }} is omitted. Do not hardcode XWiki 2.1 or any other syntax .
* When updating
a an existing document , preserve :
** Preserve
its existing current syntax and reject a when {{syntax}} is omitted.
** Reject the operation when the
supplied {{syntax}} that differs from it the document's current syntax .
*
Report the effective document syntax in every successful {{write_document}} response.
*
Update the tool schema schemas , documentation man pages and tests , including single-wiki and cross-wiki cases .