Class McpSnmpSendRaw

java.lang.Object
org.snmp4j.mcp.tool.snmp.raw.McpSnmpSendRaw
All Implemented Interfaces:
McpTool

public class McpSnmpSendRaw extends Object implements 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, distinguishing response / 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 Details

    • TOOL_ID

      public static final String TOOL_ID
      Tool ID registered with the MCP server ("snmp_send_raw").
      See Also:
    • SEND_RAW_RESULT_SCHEMA_RESOURCE_URI

      public static final String SEND_RAW_RESULT_SCHEMA_RESOURCE_URI
      MCP resource URI for the result JSON schema.
      See Also:
  • Constructor Details

  • Method Details

    • getId

      public String getId()
      Description copied from interface: McpTool
      Gets the unique identifier for this tool.
      Specified by:
      getId in interface McpTool
      Returns:
      the tool ID
    • getName

      public String getName()
      Description copied from interface: McpTool
      Gets the display name for this tool.
      Specified by:
      getName in interface McpTool
      Returns:
      the tool name
    • getVersion

      public String getVersion()
      Description copied from interface: McpTool
      Gets the version of this tool.
      Specified by:
      getVersion in interface McpTool
      Returns:
      the tool version
    • getTitle

      public String getTitle()
      Description copied from interface: McpTool
      Gets the title associated with this tool.
      Specified by:
      getTitle in interface McpTool
      Returns:
      the tool title
    • getAnnotation

      public io.modelcontextprotocol.spec.McpSchema.ToolAnnotations getAnnotation()
      Description copied from interface: McpTool
      Gets the tool annotations. By default, readOnly, hidden, idempotent, openWorld are true while destructive and returnDirect are false.
      Specified by:
      getAnnotation in interface McpTool
      Returns:
      McpSchema.ToolAnnotations
    • getDescription

      public String getDescription()
      Description copied from interface: McpTool
      Gets the description for this tool.
      Specified by:
      getDescription in interface McpTool
      Returns:
      the tool description
    • isAvailable

      public boolean isAvailable()
      Description copied from interface: McpTool
      Checks if the tool is available in the current environment.
      Specified by:
      isAvailable in interface McpTool
      Returns:
      true if the tool is available, false otherwise
    • getRequiredContexts

      public List<String> getRequiredContexts()
      Description copied from interface: McpTool
      Gets the contexts that this tool requires.
      Specified by:
      getRequiredContexts in interface McpTool
      Returns:
      a list of required context IDs
    • getParameters

      public List<ToolParameter> getParameters()
      Description copied from interface: McpTool
      Gets the supported parameters for this tool.
      Specified by:
      getParameters in interface McpTool
      Returns:
      a list of parameter descriptions
    • execute

      public ToolResult execute(Map<String,Object> params) throws McpToolException
      Description copied from interface: McpTool
      Executes the tool with the provided parameters.
      Specified by:
      execute in interface McpTool
      Parameters:
      params - the parameters to use
      Returns:
      the result of the execution
      Throws:
      McpToolException - if the tool execution fails
    • getSendRawResultSchemaJson

      public static String getSendRawResultSchemaJson()
      Returns the JSON Schema (Draft 2020-12) for the object returned by this tool.
      Returns:
      JSON Schema string