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();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.amazon.awscdk.services.bedrockagentcore.ITargetConfiguration
ITargetConfiguration.Jsii$Default -
Constructor Summary
ConstructorsModifierConstructorDescriptionLambdaTargetConfiguration(IFunction lambdaFunction, ToolSchema toolSchema) protectedLambdaTargetConfiguration(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedLambdaTargetConfiguration(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionBinds this configuration to a construct scope Sets up necessary permissions for the gateway to invoke the Lambda function.static LambdaTargetConfigurationcreate(IFunction lambdaFunction, ToolSchema toolSchema) Create a Lambda target configuration.The Lambda function that implements the MCP server logic.The target type.The tool schema that defines the available tools.protected ObjectRenders the MCP-specific configuration.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
-
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:
bindin interfaceITargetConfiguration- Specified by:
bindin classMcpTargetConfiguration- Parameters:
scope- The construct scope. This parameter is required.gateway- The gateway that will use this target. This parameter is required.
-
renderMcpConfiguration
Renders the MCP-specific configuration.- Specified by:
renderMcpConfigurationin classMcpTargetConfiguration
-
getLambdaFunction
The Lambda function that implements the MCP server logic. -
getTargetType
The target type.- Specified by:
getTargetTypein interfaceITargetConfiguration- Specified by:
getTargetTypein classMcpTargetConfiguration
-
getToolSchema
The tool schema that defines the available tools.
-