Class LambdaTargetConfiguration

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.bedrockagentcore.McpTargetConfiguration
software.amazon.awscdk.services.bedrockagentcore.LambdaTargetConfiguration
All Implemented Interfaces:
ITargetConfiguration, software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.129.0 (build eaca441)", date="2026-05-19T08:18:44.453Z") @Stability(Stable) public class LambdaTargetConfiguration extends McpTargetConfiguration
Configuration for Lambda-based MCP targets.

This configuration wraps a Lambda function as MCP tools, allowing the gateway to invoke the function to provide tool capabilities.

Example:

 Gateway gateway = Gateway.Builder.create(this, "MyGateway")
         .gatewayName("my-gateway")
         .build();
 Function myLambdaFunction = Function.Builder.create(this, "MyFunction")
         .runtime(Runtime.NODEJS_22_X)
         .handler("index.handler")
         .code(Code.fromInline("\n    exports.handler = async (event) => ({ statusCode: 200 });\n  "))
         .build();
 InlineToolSchema myToolSchema = ToolSchema.fromInline(List.of(ToolDefinition.builder()
         .name("my_tool")
         .description("My custom tool")
         .inputSchema(SchemaDefinition.builder()
                 .type(SchemaDefinitionType.OBJECT)
                 .properties(Map.of())
                 .build())
         .build()));
 // Create a custom Lambda configuration
 LambdaTargetConfiguration customConfig = LambdaTargetConfiguration.create(myLambdaFunction, myToolSchema);
 // Use the GatewayTarget constructor directly
 GatewayTarget target = GatewayTarget.Builder.create(this, "AdvancedTarget")
         .gateway(gateway)
         .gatewayTargetName("advanced-target")
         .targetConfiguration(customConfig) // Manually created configuration
         .credentialProviderConfigurations(List.of(GatewayCredentialProvider.fromIamRole()))
         .build();
 
  • Constructor Details

    • LambdaTargetConfiguration

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

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

      @Stability(Stable) public LambdaTargetConfiguration(@NotNull IFunction lambdaFunction, @NotNull ToolSchema toolSchema)
      Parameters:
      lambdaFunction - This parameter is required.
      toolSchema - This parameter is required.
  • Method Details

    • create

      @Stability(Stable) @NotNull public static LambdaTargetConfiguration create(@NotNull IFunction lambdaFunction, @NotNull ToolSchema toolSchema)
      Create a Lambda target configuration.

      Parameters:
      lambdaFunction - The Lambda function to invoke. This parameter is required.
      toolSchema - The schema defining the tools. This parameter is required.
      Returns:
      A new LambdaTargetConfiguration instance
    • bind

      @Stability(Stable) @NotNull public TargetConfigurationConfig bind(@NotNull software.constructs.Construct scope, @NotNull IGateway gateway)
      Binds this configuration to a construct scope Sets up necessary permissions for the gateway to invoke the Lambda function.

      Specified by:
      bind in interface ITargetConfiguration
      Specified by:
      bind in class McpTargetConfiguration
      Parameters:
      scope - The construct scope. This parameter is required.
      gateway - The gateway that will use this target. This parameter is required.
    • renderMcpConfiguration

      @Stability(Stable) @NotNull protected Object renderMcpConfiguration()
      Renders the MCP-specific configuration.
      Specified by:
      renderMcpConfiguration in class McpTargetConfiguration
    • getLambdaFunction

      @Stability(Stable) @NotNull public IFunction getLambdaFunction()
      The Lambda function that implements the MCP server logic.
    • getTargetType

      @Stability(Stable) @NotNull public McpTargetType getTargetType()
      The target type.
      Specified by:
      getTargetType in interface ITargetConfiguration
      Specified by:
      getTargetType in class McpTargetConfiguration
    • getToolSchema

      @Stability(Stable) @NotNull public ToolSchema getToolSchema()
      The tool schema that defines the available tools.