MCPTool Interface

Last modified by gabrielc on 2026/07/13 16:53

Content

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
manHelp No Show documentation for the available MCP tools.
query_documentsSearch & Navigation No Search and browse XWiki documents via the built-in Solr index.
get_documentSearch & Navigation No Read an XWiki document's content.
edit_documentAuthoring Yes Edit a document's content and title by exact string replacement.
write_documentAuthoring Yes Create a document or replace its entire content.
list_wikisSearch & Navigation No List the wikis reachable from this MCP endpoint.

Get Connected