Class McpToolWrapper

java.lang.Object
io.jenkins.plugins.mcp.server.tool.McpToolWrapper

public class McpToolWrapper extends Object
  • Field Details

  • Constructor Details

    • McpToolWrapper

      public McpToolWrapper(tools.jackson.databind.json.JsonMapper objectMapper, Object target, Method method)
  • Method Details

    • toolName

      public static String toolName(Method method)
      Resolves the tool name for a Tool-annotated method without instantiating an McpToolWrapper. Used during tool-override resolution to compare names before deciding which candidate to keep.
    • callWithCapturedAuth

      public static io.modelcontextprotocol.spec.McpSchema.CallToolResult callWithCapturedAuth(io.modelcontextprotocol.common.McpTransportContext context, Supplier<io.modelcontextprotocol.spec.McpSchema.CallToolResult> action)
      Runs action as the caller stored on the MCP request, after requiring Jenkins.READ.

      Annotation-backed tools do this in call(McpTransportContext, McpSchema.CallToolRequest). Programmatic McpServerExtension#getSyncTools() handlers must use this entry point as well: SSE message handling is offloaded to another thread, where the servlet security context is anonymous. An AccessDeniedException from the permission check becomes an error tool result, matching annotation-backed tools.

    • asSyncToolSpecification

      public io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification asSyncToolSpecification()
    • asStatelessSyncToolSpecification

      public io.modelcontextprotocol.server.McpStatelessServerFeatures.SyncToolSpecification asStatelessSyncToolSpecification()