java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.bedrockagentcore.GatewayTargetBase
software.amazon.awscdk.services.bedrockagentcore.GatewayTarget
All Implemented Interfaces:
IGatewayTargetRef, IEnvironmentAware, IResource, IGatewayTarget, IMcpGatewayTarget, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.129.0 (build eaca441)", date="2026-05-19T08:18:44.412Z") @Stability(Stable) public class GatewayTarget extends GatewayTargetBase implements IMcpGatewayTarget
Defines tools that your gateway will host.

Supports multiple target types:

  • Lambda: Wraps a Lambda function as MCP tools
  • OpenAPI: Exposes an OpenAPI/REST API as MCP tools
  • Smithy: Exposes a Smithy-modeled API as MCP tools

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());
 

See Also:
  • Field Details

    • PROPERTY_INJECTION_ID

      @Stability(Stable) public static final String PROPERTY_INJECTION_ID
      Uniquely identifies this class.
  • Constructor Details

    • GatewayTarget

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

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

      @Stability(Stable) public GatewayTarget(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetProps props)
      Parameters:
      scope - This parameter is required.
      id - This parameter is required.
      props - This parameter is required.
  • Method Details

    • forApiGateway

      @Stability(Stable) @NotNull public static GatewayTarget forApiGateway(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetApiGatewayProps props)
      Create an API Gateway-based target Convenience method for creating a target that connects to an API Gateway REST API.

      Parameters:
      scope - The construct scope. This parameter is required.
      id - The construct id. This parameter is required.
      props - The properties for the API Gateway target. This parameter is required.
      Returns:
      A new GatewayTarget instance
      See Also:
    • forLambda

      @Stability(Stable) @NotNull public static GatewayTarget forLambda(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetLambdaProps props)
      Create a Lambda-based MCP target Convenience method for creating a target that wraps a Lambda function.

      Parameters:
      scope - The construct scope. This parameter is required.
      id - The construct id. This parameter is required.
      props - The properties for the Lambda target. This parameter is required.
      Returns:
      A new GatewayTarget instance
    • forMcpServer

      @Stability(Stable) @NotNull public static GatewayTarget forMcpServer(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetMcpServerProps props)
      Create an MCP Server-based target Convenience method for creating a target that connects to an external MCP server.

      Parameters:
      scope - The construct scope. This parameter is required.
      id - The construct id. This parameter is required.
      props - The properties for the MCP server target. This parameter is required.
      Returns:
      A new GatewayTarget instance
      See Also:
    • forOpenApi

      @Stability(Stable) @NotNull public static GatewayTarget forOpenApi(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetOpenApiProps props)
      Create an OpenAPI-based MCP target Convenience method for creating a target that exposes an OpenAPI/REST API.

      Parameters:
      scope - The construct scope. This parameter is required.
      id - The construct id. This parameter is required.
      props - The properties for the OpenAPI target. This parameter is required.
      Returns:
      A new GatewayTarget instance
    • forSmithy

      @Stability(Stable) @NotNull public static GatewayTarget forSmithy(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetSmithyProps props)
      Create a Smithy-based MCP target Convenience method for creating a target that exposes a Smithy-modeled API.

      Parameters:
      scope - The construct scope. This parameter is required.
      id - The construct id. This parameter is required.
      props - The properties for the Smithy target. This parameter is required.
      Returns:
      A new GatewayTarget instance
    • fromGatewayTargetAttributes

      @Stability(Stable) @NotNull public static IGatewayTarget fromGatewayTargetAttributes(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull GatewayTargetAttributes attrs)
      Import an existing Gateway Target using its attributes This allows you to reference a Gateway Target that was created outside of CDK.

      Parameters:
      scope - The construct scope. This parameter is required.
      id - The construct id. This parameter is required.
      attrs - The attributes of the existing Gateway Target. This parameter is required.
      Returns:
      An IGatewayTarget instance representing the imported target
    • grantSync

      @Stability(Stable) @NotNull public Grant grantSync(@NotNull IGrantable grantee)
      Grants permission to synchronize this gateway's targets.

      This method grants the SynchronizeGatewayTargets permission, which is primarily needed for MCP Server targets when you need to refresh the tool catalog after the MCP server's tools have changed.

      [disable-awslint:no-grants]

      Parameters:
      grantee - This parameter is required.
    • getGateway

      @Stability(Stable) @NotNull public IGateway getGateway()
      The gateway this target belongs to.
      Specified by:
      getGateway in interface IGatewayTarget
      Specified by:
      getGateway in class GatewayTargetBase
    • getGatewayTargetName

      @Stability(Stable) @NotNull public String getGatewayTargetName()
      The name of the gateway target.
      Specified by:
      getGatewayTargetName in interface IGatewayTarget
      Specified by:
      getGatewayTargetName in class GatewayTargetBase
    • getTargetArn

      @Stability(Stable) @NotNull public String getTargetArn()
      The ARN of the gateway target.
      Specified by:
      getTargetArn in interface IGatewayTarget
      Specified by:
      getTargetArn in class GatewayTargetBase
    • getTargetId

      @Stability(Stable) @NotNull public String getTargetId()
      The unique identifier of the gateway target.
      Specified by:
      getTargetId in interface IGatewayTarget
      Specified by:
      getTargetId in class GatewayTargetBase
    • getTargetProtocolType

      @Stability(Stable) @NotNull public GatewayTargetProtocolType getTargetProtocolType()
      The protocol type (always MCP for now).
      Specified by:
      getTargetProtocolType in interface IGatewayTarget
      Specified by:
      getTargetProtocolType in class GatewayTargetBase
    • getTargetType

      @Stability(Stable) @NotNull public McpTargetType getTargetType()
      The specific MCP target type (Lambda, OpenAPI, Smithy, or MCP Server).
      Specified by:
      getTargetType in interface IMcpGatewayTarget
    • getCreatedAt

      @Stability(Stable) @Nullable public String getCreatedAt()
      Timestamp when the gateway target was created.
      Specified by:
      getCreatedAt in interface IGatewayTarget
      Specified by:
      getCreatedAt in class GatewayTargetBase
    • getCredentialProviderConfigurations

      @Stability(Stable) @Nullable public List<ICredentialProviderConfig> getCredentialProviderConfigurations()
      The credential providers for this target.
      Specified by:
      getCredentialProviderConfigurations in interface IGatewayTarget
      Specified by:
      getCredentialProviderConfigurations in class GatewayTargetBase
    • getDescription

      @Stability(Stable) @Nullable public String getDescription()
      Optional description for the gateway target.
      Specified by:
      getDescription in interface IGatewayTarget
      Specified by:
      getDescription in class GatewayTargetBase
    • getStatus

      @Stability(Stable) @Nullable public String getStatus()
      The status of the gateway target.
      Specified by:
      getStatus in interface IGatewayTarget
      Specified by:
      getStatus in class GatewayTargetBase
    • getStatusReasons

      @Stability(Stable) @Nullable public List<String> getStatusReasons()
      The status reasons for the gateway target.
      Specified by:
      getStatusReasons in interface IGatewayTarget
      Specified by:
      getStatusReasons in class GatewayTargetBase
    • getUpdatedAt

      @Stability(Stable) @Nullable public String getUpdatedAt()
      Timestamp when the gateway target was last updated.
      Specified by:
      getUpdatedAt in interface IGatewayTarget
      Specified by:
      getUpdatedAt in class GatewayTargetBase