Class SnmpTargetResourceTemplate

java.lang.Object
org.snmp4j.mcp.resource.snmp.SnmpTargetResourceTemplate

public class SnmpTargetResourceTemplate extends Object
Provides an MCP McpServerFeatures.SyncResourceTemplateSpecification and a McpServerFeatures.SyncCompletionSpecification that expose each configured SnmpMcpServer.ServerConfiguration.SnmpTargetConfig as a JSON resource addressed by its unique targetName.

The JSON representation of each target has all properties whose name ends in "Passphrase", "Password", or "Key" removed before the response is sent, so credentials are never exposed through the MCP interface.

Since:
0.1.0
  • Constructor Details

    • SnmpTargetResourceTemplate

      public SnmpTargetResourceTemplate(Supplier<List<SnmpMcpServer.ServerConfiguration.SnmpTargetConfig>> snmpTargetsSupplier)
      Creates a resource template backed by the given supplier. The supplier is resolved lazily at request time.
      Parameters:
      snmpTargetsSupplier - provides the current list of SnmpTargetConfig instances; may return null or an empty list when no targets are configured
  • Method Details

    • templateSpec

      public io.modelcontextprotocol.server.McpServerFeatures.SyncResourceTemplateSpecification templateSpec()
      Returns the resource template specification for snmp/target/{targetName}.
      Returns:
      sync resource template specification for SNMP target configuration lookup
    • completionSpec

      public io.modelcontextprotocol.server.McpServerFeatures.SyncCompletionSpecification completionSpec()
      Returns the completion specification that completes the targetName parameter of snmp/target/{targetName} against all configured target names.
      Returns:
      sync completion specification for the target name template