Class ToolSchema
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());
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedToolSchema(Location s3File) protectedToolSchema(Location s3File, String bucketOwnerAccountId) protectedToolSchema(Location s3File, String bucketOwnerAccountId, List<ToolDefinition> inlineSchema) protectedToolSchema(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedToolSchema(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionabstract voidbind(software.constructs.Construct scope) Bind the schema to a construct.static InlineToolSchemafromInline(List<? extends ToolDefinition> schema) Creates a Tool Schema from an inline string.static ToolSchemafromLocalAsset(String path) Creates a tool Schema from a local file.static S3ToolSchemafromS3File(IBucket bucket, String objectKey) Creates a Tool Schema from an S3 File.static S3ToolSchemafromS3File(IBucket bucket, String objectKey, String bucketOwnerAccountId) Creates a Tool Schema from an S3 File.The account ID of the S3 bucket owner for cross-account access.The inline tool schema definition as a string, if using an inline schema.The S3 location of the tool schema file, if using an S3-based schema.abstract voidgrantPermissionsToRole(IRole role) Grant permissions to the role.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
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
- 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.
-
fromLocalAsset
Creates a tool Schema from a local file.- Parameters:
path-- the path to the local file containing the function schema for the tool.
-
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.
objectKey-- object key in the bucket.
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.
objectKey-- object key in the bucket.
-
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
Grant permissions to the role.- Parameters:
role- This parameter is required.
-
getBucketOwnerAccountId
The account ID of the S3 bucket owner for cross-account access. -
getInlineSchema
The inline tool schema definition as a string, if using an inline schema.Can be in JSON or YAML format.
-
getS3File
The S3 location of the tool schema file, if using an S3-based schema.Contains the bucket name and object key information.
-