Class: ClaudeAgentSDK::PostToolUseHookSpecificOutput

Inherits:
Type
  • Object
show all
Defined in:
lib/claude_agent_sdk/types.rb

Overview

PostToolUse hook specific output.

updated_tool_output (CLI 2.1.110+) replaces the tool's output entirely — works for any tool, MCP or built-in. updated_mcp_tool_output is the legacy MCP-only field that pre-dates the unified one; the CLI still honors it, so both are emitted when set. Mirrors Python's PostToolUseHookSpecificOutput.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Type

#[], #[]=, from_hash, wrap

Constructor Details

#initialize(attributes = {}) ⇒ PostToolUseHookSpecificOutput

Returns a new instance of PostToolUseHookSpecificOutput.



1027
1028
1029
1030
# File 'lib/claude_agent_sdk/types.rb', line 1027

def initialize(attributes = {})
  super
  @hook_event_name = 'PostToolUse'
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ClaudeAgentSDK::Type

Instance Attribute Details

#additional_contextObject

Returns the value of attribute additional_context.



1024
1025
1026
# File 'lib/claude_agent_sdk/types.rb', line 1024

def additional_context
  @additional_context
end

#hook_event_nameObject (readonly)

Returns the value of attribute hook_event_name.



1025
1026
1027
# File 'lib/claude_agent_sdk/types.rb', line 1025

def hook_event_name
  @hook_event_name
end

#updated_mcp_tool_outputObject

Returns the value of attribute updated_mcp_tool_output.



1024
1025
1026
# File 'lib/claude_agent_sdk/types.rb', line 1024

def updated_mcp_tool_output
  @updated_mcp_tool_output
end

#updated_tool_outputObject

Returns the value of attribute updated_tool_output.



1024
1025
1026
# File 'lib/claude_agent_sdk/types.rb', line 1024

def updated_tool_output
  @updated_tool_output
end

Instance Method Details

#to_hObject



1032
1033
1034
1035
1036
1037
1038
# File 'lib/claude_agent_sdk/types.rb', line 1032

def to_h
  result = { hookEventName: @hook_event_name }
  result[:additionalContext] = @additional_context if @additional_context
  result[:updatedToolOutput] = @updated_tool_output unless @updated_tool_output.nil?
  result[:updatedMCPToolOutput] = @updated_mcp_tool_output if @updated_mcp_tool_output
  result
end