Class McpReadOnlyToolReconciler

java.lang.Object
com.xebialabs.xlrelease.mcp.config.McpReadOnlyToolReconciler

public class McpReadOnlyToolReconciler extends Object
Keeps the MCP server's advertised tools/list in sync with the "read-only mode" feature setting, cluster-wide and without a restart.
  • Constructor Summary

    Constructors
    Constructor
    Description
    McpReadOnlyToolReconciler(io.modelcontextprotocol.server.McpSyncServer server, List<io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification> allSpecs, ExecutorService reconcileExecutor)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    onMcpFeatureCreate(com.xebialabs.xlrelease.domain.distributed.events.DistributedConfigurationCreatedEvent event)
     
    void
    onMcpFeatureUpdate(com.xebialabs.xlrelease.domain.distributed.events.DistributedConfigurationUpdatedEvent event)
     
    void
    Brings the advertised tool set in line with the read-only flag.
    void
     
    void
    track(List<io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification> specs)
    Starts tracking tools contributed at runtime (e.g.
    void
    untrack(List<String> toolNames)
    Stops tracking withdrawn tools (bundle stopped or updated) so a later toggle won't re-add them.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • McpReadOnlyToolReconciler

      public McpReadOnlyToolReconciler(io.modelcontextprotocol.server.McpSyncServer server, List<io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification> allSpecs, ExecutorService reconcileExecutor)
  • Method Details

    • track

      public void track(List<io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification> specs)
      Starts tracking tools contributed at runtime (e.g. by an OSGi bundle) and re-applies the read-only filter to them. Without this, only tools present at startup are known, so a read-only toggle finds nothing to hide/show for bundle tools and never fires tools/list_changed.
    • untrack

      public void untrack(List<String> toolNames)
      Stops tracking withdrawn tools (bundle stopped or updated) so a later toggle won't re-add them.
    • start

      @PostConstruct public void start()
    • onMcpFeatureCreate

      public void onMcpFeatureCreate(com.xebialabs.xlrelease.domain.distributed.events.DistributedConfigurationCreatedEvent event)
    • onMcpFeatureUpdate

      public void onMcpFeatureUpdate(com.xebialabs.xlrelease.domain.distributed.events.DistributedConfigurationUpdatedEvent event)
    • reconcile

      public void reconcile()
      Brings the advertised tool set in line with the read-only flag. Idempotent and only notifies clients on a real change; mutating tools are hidden in read-only mode. Operates over the tracked tool set, so runtime tools count only once they have been registered via track(java.util.List<io.modelcontextprotocol.server.McpServerFeatures.SyncToolSpecification>).