Class McpSnmpSendRaw
java.lang.Object
org.snmp4j.mcp.tool.snmp.raw.McpSnmpSendRaw
- All Implemented Interfaces:
McpTool
MCP tool that transmits a raw, caller-supplied byte sequence to a configured SNMP target's
transport endpoint and captures the raw response — the foundational primitive for
robustness/fuzzing and security-negative testing of an SNMP agent.
Unlike the higher-level SNMP tools, this tool applies no BER encoding, PDU
construction or SNMP4J message processing: the bytes given in hexMessage are put on
the wire verbatim, so malformed, truncated, oversized or otherwise non-compliant messages can
be delivered. The destination address and transport (UDP or TCP) are taken from the named
target and can never be changed by the caller — only the payload is user-controlled.
Modes:
sendReceive(default) — send the bytes and wait for a single response, distinguishingresponse/timeout/port-unreachable;send— fire-and-forget (e.g. traps, or when a silent drop is expected);receive— bind a local UDP port and capture unsolicited inbound packets (traps/informs) for a duration or until a packet count is reached.
Typical loop: snmp_encode_ber (craft/mutate) → snmp_send_raw (transmit,
capture) → snmp_message_ber (decode the response). Set decodeResponse to
fold the last step into this tool.
- Since:
- 0.1.0
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionMcpSnmpSendRaw(Supplier<List<SnmpMcpServer.ServerConfiguration.SnmpTargetConfig>> targetsSupplier) Creates a new raw-send 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.static StringReturns the JSON Schema (Draft 2020-12) for the object returned by this tool.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
Tool ID registered with the MCP server ("snmp_send_raw").- See Also:
-
SEND_RAW_RESULT_SCHEMA_RESOURCE_URI
MCP resource URI for the result JSON schema.- See Also:
-
-
Constructor Details
-
McpSnmpSendRaw
public McpSnmpSendRaw(Supplier<List<SnmpMcpServer.ServerConfiguration.SnmpTargetConfig>> targetsSupplier) Creates a new raw-send tool.- Parameters:
targetsSupplier- supplies the configured targets; the named target's address/transport determine where bytes are sent
-
-
Method Details
-
getId
-
getName
-
getVersion
Description copied from interface:McpToolGets the version of this tool.- Specified by:
getVersionin interfaceMcpTool- Returns:
- the tool version
-
getTitle
-
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
-
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
-
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
-
getSendRawResultSchemaJson
Returns the JSON Schema (Draft 2020-12) for the object returned by this tool.- Returns:
- JSON Schema string
-