LambdaTargetConfiguration
- class aws_cdk.aws_bedrock_agentcore_alpha.LambdaTargetConfiguration(lambda_function, tool_schema)
Bases:
McpTargetConfiguration(experimental) 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.
- Stability:
experimental
- ExampleMetadata:
infused
Example:
gateway = agentcore.Gateway(self, "MyGateway", gateway_name="my-gateway" ) my_lambda_function = lambda_.Function(self, "MyFunction", runtime=lambda_.Runtime.NODEJS_22_X, handler="index.handler", code=lambda_.Code.from_inline(""" exports.handler = async (event) => ({ statusCode: 200 }); """) ) my_tool_schema = agentcore.ToolSchema.from_inline([ name="my_tool", description="My custom tool", input_schema=agentcore.SchemaDefinition( type=agentcore.SchemaDefinitionType.OBJECT, properties={} ) ]) # Create a custom Lambda configuration custom_config = agentcore.LambdaTargetConfiguration.create(my_lambda_function, my_tool_schema) # Use the GatewayTarget constructor directly target = agentcore.GatewayTarget(self, "AdvancedTarget", gateway=gateway, gateway_target_name="advanced-target", target_configuration=custom_config, # Manually created configuration credential_provider_configurations=[ agentcore.GatewayCredentialProvider.from_iam_role() ] )
- Parameters:
lambda_function (
IFunction)tool_schema (
ToolSchema)
- Stability:
experimental
Methods
- bind(scope, gateway)
(experimental) Binds this configuration to a construct scope Sets up necessary permissions for the gateway to invoke the Lambda function.
- Parameters:
- Stability:
experimental
- Return type:
Attributes
- lambda_function
(experimental) The Lambda function that implements the MCP server logic.
- Stability:
experimental
- target_type
(experimental) The target type.
- Stability:
experimental
- tool_schema
(experimental) The tool schema that defines the available tools.
- Stability:
experimental
Static Methods
- classmethod create(lambda_function, tool_schema)
(experimental) Create a Lambda target configuration.
- Parameters:
lambda_function (
IFunction) – The Lambda function to invoke.tool_schema (
ToolSchema) – The schema defining the tools.
- Return type:
- Returns:
A new LambdaTargetConfiguration instance
- Stability:
experimental