Skip to content
v2.278.0

ToolDefinition Struct ​

Tool definition for inline payload.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_bedrockagentcore as bedrockagentcore } from 'aws-cdk-lib';

declare const schemaDefinition_: bedrockagentcore.SchemaDefinition;
declare const schemaDefinitionType: bedrockagentcore.SchemaDefinitionType;
const toolDefinition: bedrockagentcore.ToolDefinition = {
  description: 'description',
  inputSchema: {
    type: schemaDefinitionType,

    // the properties below are optional
    description: 'description',
    items: schemaDefinition_,
    properties: {
      propertiesKey: schemaDefinition_,
    },
    required: ['required'],
  },
  name: 'name',

  // the properties below are optional
  outputSchema: {
    type: schemaDefinitionType,

    // the properties below are optional
    description: 'description',
    items: schemaDefinition_,
    properties: {
      propertiesKey: schemaDefinition_,
    },
    required: ['required'],
  },
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_bedrockagentcore as bedrockagentcore

# schema_definition_: bedrockagentcore.SchemaDefinition
# schema_definition_type: bedrockagentcore.SchemaDefinitionType

tool_definition = bedrockagentcore.ToolDefinition(
    description="description",
    input_schema=bedrockagentcore.SchemaDefinition(
        type=schema_definition_type,

        # the properties below are optional
        description="description",
        items=schema_definition_,
        properties={
            "properties_key": schema_definition_
        },
        required=["required"]
    ),
    name="name",

    # the properties below are optional
    output_schema=bedrockagentcore.SchemaDefinition(
        type=schema_definition_type,

        # the properties below are optional
        description="description",
        items=schema_definition_,
        properties={
            "properties_key": schema_definition_
        },
        required=["required"]
    )
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrockagentcore.*;

SchemaDefinition schemaDefinition_;
SchemaDefinitionType schemaDefinitionType;

ToolDefinition toolDefinition = ToolDefinition.builder()
        .description("description")
        .inputSchema(SchemaDefinition.builder()
                .type(schemaDefinitionType)

                // the properties below are optional
                .description("description")
                .items(schemaDefinition_)
                .properties(Map.of(
                        "propertiesKey", schemaDefinition_))
                .required(List.of("required"))
                .build())
        .name("name")

        // the properties below are optional
        .outputSchema(SchemaDefinition.builder()
                .type(schemaDefinitionType)

                // the properties below are optional
                .description("description")
                .items(schemaDefinition_)
                .properties(Map.of(
                        "propertiesKey", schemaDefinition_))
                .required(List.of("required"))
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.BedrockAgentCore;

SchemaDefinition schemaDefinition_;
SchemaDefinitionType schemaDefinitionType;

var toolDefinition = new ToolDefinition {
    Description = "description",
    InputSchema = new SchemaDefinition {
        Type = schemaDefinitionType,

        // the properties below are optional
        Description = "description",
        Items = schemaDefinition_,
        Properties = new Dictionary<string, SchemaDefinition> {
            { "propertiesKey", schemaDefinition_ }
        },
        Required = new [] { "required" }
    },
    Name = "name",

    // the properties below are optional
    OutputSchema = new SchemaDefinition {
        Type = schemaDefinitionType,

        // the properties below are optional
        Description = "description",
        Items = schemaDefinition_,
        Properties = new Dictionary<string, SchemaDefinition> {
            { "propertiesKey", schemaDefinition_ }
        },
        Required = new [] { "required" }
    }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var schemaDefinition_ SchemaDefinition
var schemaDefinitionType SchemaDefinitionType

toolDefinition := &ToolDefinition{
	Description: jsii.String("description"),
	InputSchema: &SchemaDefinition{
		Type: schemaDefinitionType,

		// the properties below are optional
		Description: jsii.String("description"),
		Items: schemaDefinition_,
		Properties: map[string]SchemaDefinition{
			"propertiesKey": schemaDefinition_,
		},
		Required: []*string{
			jsii.String("required"),
		},
	},
	Name: jsii.String("name"),

	// the properties below are optional
	OutputSchema: &SchemaDefinition{
		Type: schemaDefinitionType,

		// the properties below are optional
		Description: jsii.String("description"),
		Items: schemaDefinition_,
		Properties: map[string]SchemaDefinition{
			"propertiesKey": schemaDefinition_,
		},
		Required: []*string{
			jsii.String("required"),
		},
	},
}

Properties ​

descriptionstringdescriptionstrdescriptionStringDescriptionstringDescription*string required #
The description of the tool.

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

inputSchemaSchemaDefinitioninput_schemaSchemaDefinitioninputSchemaSchemaDefinitionInputSchemaSchemaDefinitionInputSchemaSchemaDefinition required #
The input schema for the tool.

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

namestringnamestrnameStringNamestringName*string required #
The name of the tool.

This name identifies the tool in the Model Context Protocol.

outputSchemaoptionalSchemaDefinitionoutput_schemaoptionalSchemaDefinitionoutputSchemaoptionalSchemaDefinitionOutputSchemaoptionalSchemaDefinitionOutputSchemaoptionalSchemaDefinition #
The output schema for the tool.

Default: No output schema

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