java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.bedrockagentcore.ToolSchema
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
Direct Known Subclasses:
AssetToolSchema, InlineToolSchema, S3ToolSchema

@Generated(value="jsii-pacmak/1.129.0 (build eaca441)", date="2026-05-19T08:18:44.508Z") @Stability(Stable) public abstract class ToolSchema extends software.amazon.jsii.JsiiObject
**************************************************************************** TOOL SCHEMA CLASS ***************************************************************************.

Example:

 Gateway gateway = Gateway.Builder.create(this, "MyGateway")
         .gatewayName("my-gateway")
         .build();
 Function lambdaFunction = Function.Builder.create(this, "MyFunction")
         .runtime(Runtime.NODEJS_22_X)
         .handler("index.handler")
         .code(Code.fromInline("\n        exports.handler = async (event) => {\n            return {\n                statusCode: 200,\n                body: JSON.stringify({ message: 'Hello from Lambda!' })\n            };\n        };\n    "))
         .build();
 // Create a gateway target with Lambda and tool schema
 GatewayTarget target = GatewayTarget.forLambda(this, "MyLambdaTarget", GatewayTargetLambdaProps.builder()
         .gatewayTargetName("my-lambda-target")
         .description("Target for Lambda function integration")
         .gateway(gateway)
         .lambdaFunction(lambdaFunction)
         .toolSchema(ToolSchema.fromLocalAsset(path.join(__dirname, "schemas", "my-tool-schema.json")))
         .build());
 
  • Constructor Details

    • ToolSchema

      protected ToolSchema(software.amazon.jsii.JsiiObjectRef objRef)
    • ToolSchema

      protected ToolSchema(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • ToolSchema

      @Stability(Stable) protected ToolSchema(@Nullable Location s3File, @Nullable String bucketOwnerAccountId, @Nullable List<ToolDefinition> inlineSchema)
      Parameters:
      s3File -
      bucketOwnerAccountId -
      inlineSchema -
    • ToolSchema

      @Stability(Stable) protected ToolSchema(@Nullable Location s3File, @Nullable String bucketOwnerAccountId)
      Parameters:
      s3File -
      bucketOwnerAccountId -
    • ToolSchema

      @Stability(Stable) protected ToolSchema(@Nullable Location s3File)
      Parameters:
      s3File -
    • ToolSchema

      @Stability(Stable) protected ToolSchema()
  • Method Details

    • fromInline

      @Stability(Stable) @NotNull public static InlineToolSchema fromInline(@NotNull List<? extends ToolDefinition> schema)
      Creates a Tool Schema from an inline string.

      Parameters:
      schema -
      • the JSON or YAML payload defining the OpenAPI schema for the action group.
      This parameter is required.
    • fromLocalAsset

      @Stability(Stable) @NotNull public static ToolSchema fromLocalAsset(@NotNull String path)
      Creates a tool Schema from a local file.

      Parameters:
      path -
      • the path to the local file containing the function schema for the tool.
      This parameter is required.
    • fromS3File

      @Stability(Stable) @NotNull public static S3ToolSchema fromS3File(@NotNull IBucket bucket, @NotNull String objectKey, @Nullable String bucketOwnerAccountId)
      Creates a Tool Schema from an S3 File.

      Parameters:
      bucket -
      • the bucket containing the local file containing the OpenAPI schema for the action group.
      This parameter is required.
      objectKey -
      • object key in the bucket.
      This parameter is required.
      bucketOwnerAccountId -
      • optional The account ID of the Amazon S3 bucket owner.
    • fromS3File

      @Stability(Stable) @NotNull public static S3ToolSchema fromS3File(@NotNull IBucket bucket, @NotNull String objectKey)
      Creates a Tool Schema from an S3 File.

      Parameters:
      bucket -
      • the bucket containing the local file containing the OpenAPI schema for the action group.
      This parameter is required.
      objectKey -
      • object key in the bucket.
      This parameter is required.
    • bind

      @Stability(Stable) public abstract void bind(@NotNull software.constructs.Construct scope)
      Bind the schema to a construct.

      Parameters:
      scope - This parameter is required.
    • grantPermissionsToRole

      @Stability(Stable) public abstract void grantPermissionsToRole(@NotNull IRole role)
      Grant permissions to the role.

      Parameters:
      role - This parameter is required.
    • getBucketOwnerAccountId

      @Stability(Stable) @Nullable public String getBucketOwnerAccountId()
      The account ID of the S3 bucket owner for cross-account access.
    • getInlineSchema

      @Stability(Stable) @Nullable public List<ToolDefinition> getInlineSchema()
      The inline tool schema definition as a string, if using an inline schema.

      Can be in JSON or YAML format.

    • getS3File

      @Stability(Stable) @Nullable public Location getS3File()
      The S3 location of the tool schema file, if using an S3-based schema.

      Contains the bucket name and object key information.