Class ToolInvocationGate
java.lang.Object
eu.mrapik.minecraftservermcp.internal.ToolInvocationGate
Bridges MCP
McpToolDefinition instances to the SDK's McpServerFeatures.AsyncToolSpecification by
enforcing access control before the handler runs.
Flow for each call:
- Read the token string from
McpTransportContext(set byMcpHttpServer's context extractor from the HTTP request). - Resolve the token to a profile via
PluginSettings.profileByToken(String). - Load
ToolAccessConfigfor this tool id; ifToolAccessConfig.enabled()is false, return an error result. - Build
McpToolInvocationImpland invokeMcpToolDefinition.call(McpToolInvocation).
-
Method Summary
Modifier and TypeMethodDescriptionstatic io.modelcontextprotocol.server.McpServerFeatures.AsyncToolSpecificationwrapDefinition(McpToolDefinition def, Supplier<PluginSettings> settings, JavaPlugin mcpPlugin, ServerFilePaths paths) Wraps a definition so every invocation goes throughrunWithAccess(java.lang.String, io.modelcontextprotocol.server.McpAsyncServerExchange, io.modelcontextprotocol.spec.McpSchema.CallToolRequest, java.util.function.Supplier<eu.mrapik.minecraftservermcp.config.PluginSettings>, org.bukkit.plugin.java.JavaPlugin, eu.mrapik.minecraftservermcp.fs.ServerFilePaths, java.util.function.Function<eu.mrapik.minecraftservermcp.api.McpToolInvocation, reactor.core.publisher.Mono<io.modelcontextprotocol.spec.McpSchema.CallToolResult>>).
-
Method Details
-
wrapDefinition
public static io.modelcontextprotocol.server.McpServerFeatures.AsyncToolSpecification wrapDefinition(McpToolDefinition def, Supplier<PluginSettings> settings, JavaPlugin mcpPlugin, ServerFilePaths paths) Wraps a definition so every invocation goes throughrunWithAccess(java.lang.String, io.modelcontextprotocol.server.McpAsyncServerExchange, io.modelcontextprotocol.spec.McpSchema.CallToolRequest, java.util.function.Supplier<eu.mrapik.minecraftservermcp.config.PluginSettings>, org.bukkit.plugin.java.JavaPlugin, eu.mrapik.minecraftservermcp.fs.ServerFilePaths, java.util.function.Function<eu.mrapik.minecraftservermcp.api.McpToolInvocation, reactor.core.publisher.Mono<io.modelcontextprotocol.spec.McpSchema.CallToolResult>>).- Parameters:
def- tool metadata and handlersettings- current plugin settings (token → profile map)mcpPlugin- MCP plugin instance passed intoMcpToolInvocationImplpaths- server file path helper for invocations- Returns:
- SDK tool specification registered on
McpAsyncServer
-