Class SnmpSet
java.lang.Object
org.snmp4j.mcp.tool.snmp.set.SnmpSet
- All Implemented Interfaces:
McpTool
MCP Tool that issues an SNMP GET (default, read-only) or SET request against a
configured target. The variable bindings are supplied as a single plain-text string
— one entry per line or per comma, auto-detected by the separator that appears
first in the input.
Input format:
- Read-only mode (default): each entry is an OID, e.g.
1.3.6.1.2.1.1.1.0, 1.3.6.1.2.1.1.5.0. If an entry contains an=, the part after it is ignored. - Write mode (
set=true): each entry isOID=value; the value string follows the SNMP4J inline syntax (e.g.1.3.6.1.2.1.1.5.0=string:newName). When notype:prefix is present and aSmiManageris configured, the type is resolved from the MIB; otherwise the value falls back toOctetString.
The Target, Snmp session, and PduBuilder are obtained
via McpSnmpBuilder — following the same pattern as
McpSnmpTree.
- Since:
- 0.1.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSnmpSet(Supplier<List<SnmpMcpServer.ServerConfiguration.SnmpTargetConfig>> snmpTargetsSupplier, com.snmp4j.smi.SmiManager smiManager) Creates a new SNMP GET/SET tool. -
Method Summary
Modifier and TypeMethodDescriptionExecutes the tool with the provided parameters.io.modelcontextprotocol.spec.McpSchema.ToolAnnotationsGets the tool annotations.Gets the description for this tool.getId()Gets the unique identifier for this tool.getName()Gets the display name for this tool.Gets the supported parameters for this tool.Gets the contexts that this tool requires.getTitle()Gets the title associated with this tool.Gets the version of this tool.booleanChecks if the tool is available in the current environment.
-
Field Details
-
TOOL_ID
-
-
Constructor Details
-
SnmpSet
public SnmpSet(Supplier<List<SnmpMcpServer.ServerConfiguration.SnmpTargetConfig>> snmpTargetsSupplier, com.snmp4j.smi.SmiManager smiManager) Creates a new SNMP GET/SET tool.- Parameters:
snmpTargetsSupplier- supplies the list of configured SNMP targetssmiManager- used for value parsing and MIB-aware response formatting; may benull
-
-
Method Details
-
getId
-
getName
-
getVersion
Description copied from interface:McpToolGets the version of this tool.- Specified by:
getVersionin interfaceMcpTool- Returns:
- the tool version
-
getTitle
-
getDescription
Description copied from interface:McpToolGets the description for this tool.- Specified by:
getDescriptionin interfaceMcpTool- Returns:
- the tool description
-
isAvailable
public boolean isAvailable()Description copied from interface:McpToolChecks if the tool is available in the current environment.- Specified by:
isAvailablein interfaceMcpTool- Returns:
- true if the tool is available, false otherwise
-
getRequiredContexts
Description copied from interface:McpToolGets the contexts that this tool requires.- Specified by:
getRequiredContextsin interfaceMcpTool- Returns:
- a list of required context IDs
-
getParameters
Description copied from interface:McpToolGets the supported parameters for this tool.- Specified by:
getParametersin interfaceMcpTool- Returns:
- a list of parameter descriptions
-
getAnnotation
public io.modelcontextprotocol.spec.McpSchema.ToolAnnotations getAnnotation()Description copied from interface:McpToolGets the tool annotations. By default, readOnly, hidden, idempotent, openWorld are true while destructive and returnDirect are false.- Specified by:
getAnnotationin interfaceMcpTool- Returns:
McpSchema.ToolAnnotations
-
execute
Description copied from interface:McpToolExecutes the tool with the provided parameters.- Specified by:
executein interfaceMcpTool- Parameters:
params- the parameters to use- Returns:
- the result of the execution
- Throws:
McpToolException- if the tool execution fails
-