Class PostToolUseFailureHookInput

java.lang.Object
com.github.copilot.rpc.PostToolUseFailureHookInput

public class PostToolUseFailureHookInput extends Object
Input for a post-tool-use-failure hook.

Fires after a tool execution whose result was "failure". The CLI extracts the failure message from the tool result and passes it as the getError() field (rather than passing the full result object).

Since:
1.3.0
  • Constructor Details

    • PostToolUseFailureHookInput

      public PostToolUseFailureHookInput()
  • Method Details

    • getSessionId

      public String getSessionId()
      Gets the runtime session ID of the session that triggered the hook.
      Returns:
      the session ID
    • setSessionId

      public PostToolUseFailureHookInput setSessionId(String sessionId)
      Sets the runtime session ID of the session that triggered the hook.
      Parameters:
      sessionId - the session ID
      Returns:
      this instance for method chaining
    • getTimestamp

      public long getTimestamp()
      Gets the timestamp of the hook invocation.
      Returns:
      the timestamp in milliseconds
    • setTimestamp

      public PostToolUseFailureHookInput setTimestamp(long timestamp)
      Sets the timestamp of the hook invocation.
      Parameters:
      timestamp - the timestamp in milliseconds
      Returns:
      this instance for method chaining
    • getCwd

      public String getCwd()
      Gets the current working directory.
      Returns:
      the working directory path
    • setCwd

      public PostToolUseFailureHookInput setCwd(String cwd)
      Sets the current working directory.
      Parameters:
      cwd - the working directory path
      Returns:
      this instance for method chaining
    • getToolName

      public String getToolName()
      Gets the name of the tool that failed.
      Returns:
      the tool name
    • setToolName

      public PostToolUseFailureHookInput setToolName(String toolName)
      Sets the name of the tool that failed.
      Parameters:
      toolName - the tool name
      Returns:
      this instance for method chaining
    • getToolArgs

      public com.fasterxml.jackson.databind.JsonNode getToolArgs()
      Gets the arguments passed to the tool.
      Returns:
      the tool arguments as a JSON node
    • setToolArgs

      public PostToolUseFailureHookInput setToolArgs(com.fasterxml.jackson.databind.JsonNode toolArgs)
      Sets the arguments passed to the tool.
      Parameters:
      toolArgs - the tool arguments as a JSON node
      Returns:
      this instance for method chaining
    • getError

      public String getError()
      Gets the failure message extracted from the tool's result.
      Returns:
      the error message
    • setError

      public PostToolUseFailureHookInput setError(String error)
      Sets the failure message extracted from the tool's result.
      Parameters:
      error - the error message
      Returns:
      this instance for method chaining