Interface McpToolDefinition
tools/list, and an asynchronous handler
for tools/call.
Id and config: id() must match McpSchema.Tool.name() exactly. The same string is used as the
key under access.<profile>.tools.<toolId> in config.yml, so administrators can enable or
disable the tool and set allow/deny lists per token. Custom YAML keys under that section are exposed through
McpToolInvocation.toolConfig().extra().
Ownership: owningPlugin() should be the plugin that registered the tool. When that plugin disables,
it should call MinecraftServerMcp.unregisterTool(String) for each tool it added so clients do not keep stale entries.
Threading: Implementations return Mono; the MCP stack may invoke the handler off the main server thread.
If you must touch the Bukkit API only on the main thread, schedule work accordingly (see built-in tools for examples).
-
Method Summary
Modifier and TypeMethodDescription@NotNull reactor.core.publisher.Mono<io.modelcontextprotocol.spec.McpSchema.CallToolResult> call(@NotNull McpToolInvocation invocation) Handles a singletools/callafter authentication and per-token policy checks.@NotNull Stringid()Unique MCP tool name.@NotNull PluginPlugin that owns this tool registration (logging, lifecycle).io.modelcontextprotocol.spec.McpSchema.Tooltool()Metadata advertised to MCP clients.
-
Method Details
-
id
Unique MCP tool name. Must equaltool().name().- Returns:
- the tool id, typically prefixed for third-party plugins (e.g.
myplugin_action) to avoid collisions
-
owningPlugin
Plugin that owns this tool registration (logging, lifecycle).- Returns:
- the registering plugin
-
tool
@NotNull io.modelcontextprotocol.spec.McpSchema.Tool tool()Metadata advertised to MCP clients. TheMcpSchema.Tool.name()must equalid().- Returns:
- tool listing entry including description and JSON Schema for arguments
-
call
@NotNull @NotNull reactor.core.publisher.Mono<io.modelcontextprotocol.spec.McpSchema.CallToolResult> call(@NotNull @NotNull McpToolInvocation invocation) Handles a singletools/callafter authentication and per-token policy checks.The
McpToolInvocationincludes the resolved profile,ToolAccessConfigfor this tool id, server paths, and global settings (e.g. max read size for file tools).- Parameters:
invocation- context for this call; not null- Returns:
- a cold
Monothat emits oneMcpSchema.CallToolResult
-