class LambdaTargetConfiguration
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Bedrock.Agentcore.Alpha.LambdaTargetConfiguration |
Go | github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2#LambdaTargetConfiguration |
Java | software.amazon.awscdk.services.bedrock.agentcore.alpha.LambdaTargetConfiguration |
Python | aws_cdk.aws_bedrock_agentcore_alpha.LambdaTargetConfiguration |
TypeScript (source) | @aws-cdk/aws-bedrock-agentcore-alpha ยป LambdaTargetConfiguration |
Implements
ITarget
Extends
Mcp
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
const gateway = new agentcore.Gateway(this, "MyGateway", {
gatewayName: "my-gateway",
});
const myLambdaFunction = new lambda.Function(this, "MyFunction", {
runtime: lambda.Runtime.NODEJS_22_X,
handler: "index.handler",
code: lambda.Code.fromInline(`
exports.handler = async (event) => ({ statusCode: 200 });
`),
});
const myToolSchema = agentcore.ToolSchema.fromInline([{
name: "my_tool",
description: "My custom tool",
inputSchema: {
type: agentcore.SchemaDefinitionType.OBJECT,
properties: {},
},
}]);
// Create a custom Lambda configuration
const customConfig = agentcore.LambdaTargetConfiguration.create(
myLambdaFunction,
myToolSchema
);
// Use the GatewayTarget constructor directly
const target = new agentcore.GatewayTarget(this, "AdvancedTarget", {
gateway: gateway,
gatewayTargetName: "advanced-target",
targetConfiguration: customConfig, // Manually created configuration
credentialProviderConfigurations: [
agentcore.GatewayCredentialProvider.fromIamRole()
]
});
Initializer
new LambdaTargetConfiguration(lambdaFunction: IFunction, toolSchema: ToolSchema)
Parameters
- lambdaFunction
IFunction - toolSchema
ToolSchema
Properties
| Name | Type | Description |
|---|---|---|
| lambda | IFunction | The Lambda function that implements the MCP server logic. |
| target | Mcp | The target type. |
| tool | Tool | The tool schema that defines the available tools. |
lambdaFunction
Type:
IFunction
The Lambda function that implements the MCP server logic.
targetType
Type:
Mcp
The target type.
toolSchema
Type:
Tool
The tool schema that defines the available tools.
Methods
| Name | Description |
|---|---|
| bind(scope, gateway) | Binds this configuration to a construct scope Sets up necessary permissions for the gateway to invoke the Lambda function. |
| protected render | Renders the MCP-specific configuration. |
| static create(lambdaFunction, toolSchema) | Create a Lambda target configuration. |
bind(scope, gateway)
public bind(scope: Construct, gateway: IGateway): TargetConfigurationConfig
Parameters
- scope
Constructโ The construct scope. - gateway
IGatewayโ The gateway that will use this target.
Returns
Binds this configuration to a construct scope Sets up necessary permissions for the gateway to invoke the Lambda function.
protected renderMcpConfiguration()
protected renderMcpConfiguration(): any
Returns
any
Renders the MCP-specific configuration.
static create(lambdaFunction, toolSchema)
public static create(lambdaFunction: IFunction, toolSchema: ToolSchema): LambdaTargetConfiguration
Parameters
- lambdaFunction
IFunctionโ The Lambda function to invoke. - toolSchema
Toolโ The schema defining the tools.Schema
Returns
Create a Lambda target configuration.

.NET
Go
Java
Python
TypeScript (