MCPTool Interface
Reference
The MCPTool interface (org.xwiki.contrib.llm.mcp.MCPTool), annotated @Role and @Unstable, is the extension point for contributing tools to the XWiki MCP server.
Methods
getToolDefinition
McpSchema.Tool getToolDefinition()Returns the MCP tool definition: name, description, and input JSON schema. The description is sent to the LLM on every call — keep it lean.
execute
McpSchema.CallToolResult execute(McpSchema.CallToolRequest request)Executes the tool call. Runs as the authenticated user on the request thread. Return errors as isError results with actionable messages.
isEnabled
default boolean isEnabled()Global kill switch. Disabled tools are not registered on any wiki. Default: true.
isWrite
default boolean isWrite()Whether the tool modifies wiki content. Write tools are off by default per wiki. Default: false.
getCategory
default String getCategory()Category for the man catalog grouping. Default: "General".
getSummary
default String getSummary()One-line summary for the man catalog listing. Default: null.
getManPage
default String getManPage()Long-form documentation prose for the man tool. Include EXAMPLES section. Default: null.
Conventions
- The component hint (
@Named) is the stable tool id — used in configuration and logs. - The description in
getToolDefinition()must never duplicate parameter descriptions (they ship in the same payload). - Parameter descriptions state defaults explicitly:
"(default 10)." - Every error message ends with the corrective next action when one exists.
- Use
"Error: "prefix only for malformed parameters. State outcomes (not found, not authorized) have no prefix.
The bundled tools
Each tool's id, category, write flag and one-line summary come from the component itself, so the list a wiki actually serves is the one man prints, and the tools shipped with the server are named on MCP Tools. The AI-LLM indexing module contributes two more when it is installed, both in the Semantic Search category and neither a write tool.