Interface McpToolInvocation

All Known Implementing Classes:
McpToolInvocationImpl

public interface McpToolInvocation
Everything a tool handler needs for one tools/call: the raw MCP request, the authenticated access profile, and the effective policy for this tool id.

The HTTP layer attaches the client's token to the transport context before the MCP stack invokes handler. The implementation resolves that token to a TokenAccessProfile and loads access.<profileName>.tools.<toolId> as a ToolAccessConfig. If the profile has no section for this tool id, a permissive default applies (tool enabled, no list filters).

  • Method Details

    • exchange

      @NotNull @NotNull io.modelcontextprotocol.server.McpAsyncServerExchange exchange()
      MCP session exchange (transport, session state).
      Returns:
      the async server exchange for this request
    • request

      @NotNull io.modelcontextprotocol.spec.McpSchema.CallToolRequest request()
      The tool call request, including the arguments map parsed from JSON.
      Returns:
      the MCP CallToolRequest
    • profile

      @NotNull @NotNull TokenAccessProfile profile()
      Access profile tied to the token used on this connection (from config.yml access.*).
      Returns:
      profile name and token metadata
    • toolConfig

      @NotNull @NotNull ToolAccessConfig toolConfig()
      Effective policy for McpToolDefinition.id() under this profile.

      Standard keys map to typed fields (file/folder/command lists). Any other keys from the YAML section are preserved in ToolAccessConfig.extra() for custom tools.

      Returns:
      merged policy; never null
    • mcpPlugin

      @NotNull @NotNull JavaPlugin mcpPlugin()
      The MinecraftServerMCP plugin instance (scheduler, data folder, logger).
      Returns:
      this MCP plugin
    • serverPaths

      @NotNull @NotNull ServerFilePaths serverPaths()
      Paths relative to the Minecraft server root directory, with traversal checks.

      Use when implementing file-based tools so paths stay within the server tree.

      Returns:
      resolved server root and helpers
    • pluginSettings

      @NotNull @NotNull PluginSettings pluginSettings()
      Snapshot of global plugin settings (bind address, port, PluginSettings.maxReadBytes(), etc.).

      Reflects configuration at invocation time; call MinecraftServerMcp.reloadConfiguration() on the service to reload config.yml before relying on updated values in new invocations.

      Returns:
      current PluginSettings