Class: AWSCDK::BedrockAgentCore::ToolDefinition

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
bedrock_agent_core/tool_definition.rb

Overview

Tool definition for inline payload.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description:, input_schema:, name:, output_schema: nil) ⇒ ToolDefinition

Returns a new instance of ToolDefinition.

Parameters:



11
12
13
14
15
16
17
18
19
20
# File 'bedrock_agent_core/tool_definition.rb', line 11

def initialize(description:, input_schema:, name:, output_schema: nil)
  @description = description
  Jsii::Type.check_type(@description, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "description")
  @input_schema = input_schema.is_a?(Hash) ? ::AWSCDK::BedrockAgentCore::SchemaDefinition.new(**input_schema.transform_keys(&:to_sym)) : input_schema
  Jsii::Type.check_type(@input_schema, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmVkcm9ja2FnZW50Y29yZS5TY2hlbWFEZWZpbml0aW9uIn0=")), "inputSchema")
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  @output_schema = output_schema.is_a?(Hash) ? ::AWSCDK::BedrockAgentCore::SchemaDefinition.new(**output_schema.transform_keys(&:to_sym)) : output_schema
  Jsii::Type.check_type(@output_schema, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5hd3NfYmVkcm9ja2FnZW50Y29yZS5TY2hlbWFEZWZpbml0aW9uIn0=")), "outputSchema") unless @output_schema.nil?
end

Instance Attribute Details

#descriptionString (readonly)

The description of the tool.

This description provides information about the purpose and usage of the tool.

Returns:

  • (String)


27
28
29
# File 'bedrock_agent_core/tool_definition.rb', line 27

def description
  @description
end

#input_schemaAWSCDK::BedrockAgentCore::SchemaDefinition (readonly)

The input schema for the tool.

This schema defines the structure of the input that the tool accepts.



33
34
35
# File 'bedrock_agent_core/tool_definition.rb', line 33

def input_schema
  @input_schema
end

#nameString (readonly)

The name of the tool.

This name identifies the tool in the Model Context Protocol.

Returns:

  • (String)


39
40
41
# File 'bedrock_agent_core/tool_definition.rb', line 39

def name
  @name
end

#output_schemaAWSCDK::BedrockAgentCore::SchemaDefinition? (readonly)

Note:

Default: - No output schema

The output schema for the tool.

This schema defines the structure of the output that the tool produces.



46
47
48
# File 'bedrock_agent_core/tool_definition.rb', line 46

def output_schema
  @output_schema
end

Class Method Details

.jsii_propertiesObject



48
49
50
51
52
53
54
55
# File 'bedrock_agent_core/tool_definition.rb', line 48

def self.jsii_properties
  {
    :description => "description",
    :input_schema => "inputSchema",
    :name => "name",
    :output_schema => "outputSchema",
  }
end

Instance Method Details

#to_jsiiObject



57
58
59
60
61
62
63
64
65
66
# File 'bedrock_agent_core/tool_definition.rb', line 57

def to_jsii
  result = {}
  result.merge!({
    "description" => @description,
    "inputSchema" => @input_schema,
    "name" => @name,
    "outputSchema" => @output_schema,
  })
  result.compact
end