MCPTool Interface
Reference
The MCPTool interface (org.xwiki.contrib.llm.mcp.MCPTool) is the extension point for contributing tools to the XWiki MCP server.
MCP Server 0.9+ Annotations: @Role, @Unstable.
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.
Bundled tool metadata
| Tool ID | Category | Write | Summary |
|---|---|---|---|
man | Help | No | Show documentation for the available MCP tools. |
query_documents | Search & Navigation | No | Search and browse XWiki documents via the built-in Solr index. |
get_document | Search & Navigation | No | Read an XWiki document's content. |
edit_document | Authoring | Yes | Edit a document's content and title by exact string replacement. |
write_document | Authoring | Yes | Create a document or replace its entire content. |
list_wikis | Search & Navigation | No | List the wikis reachable from this MCP endpoint. |