LambdaTargetConfiguration Class
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.
| Source | lib/gateway/targets/target-configuration.ts |
|---|
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as bedrock_agentcore_alpha from '@aws-cdk/aws-bedrock-agentcore-alpha';
import { aws_lambda as lambda } from 'aws-cdk-lib';
declare const function_: lambda.Function;
declare const toolSchema: bedrock_agentcore_alpha.ToolSchema;
const lambdaTargetConfiguration = new bedrock_agentcore_alpha.LambdaTargetConfiguration(function_, toolSchema);
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_bedrock_agentcore_alpha as bedrock_agentcore_alpha
from aws_cdk import aws_lambda as lambda_
# function_: lambda.Function
# tool_schema: bedrock_agentcore_alpha.ToolSchema
lambda_target_configuration = bedrock_agentcore_alpha.LambdaTargetConfiguration(function_, tool_schema)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.agentcore.alpha.*;
import software.amazon.awscdk.services.lambda.*;
Function function_;
ToolSchema toolSchema;
LambdaTargetConfiguration lambdaTargetConfiguration = new LambdaTargetConfiguration(function_, toolSchema);
csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Agentcore.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Bedrock.Agentcore.Alpha;
using Amazon.CDK.AWS.Lambda;
Function function_;
ToolSchema toolSchema;
var lambdaTargetConfiguration = new LambdaTargetConfiguration(function_, toolSchema);
go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_agentcore_alpha "github.com/aws/aws-cdk-go/awsbedrockagentcorealpha"
import "github.com/aws/aws-cdk-go/awscdk"
var function_ Function
var toolSchema ToolSchema
lambdaTargetConfiguration := bedrock_agentcore_alpha.NewLambdaTargetConfiguration(function_, toolSchema)
Initializer
ts
new LambdaTargetConfiguration(lambdaFunction: IFunction, toolSchema: ToolSchema)
python
LambdaTargetConfiguration(lambda_function: IFunction, tool_schema: ToolSchema)
java
new LambdaTargetConfiguration(IFunction lambdaFunction, ToolSchema toolSchema)
csharp
new LambdaTargetConfiguration(IFunction lambdaFunction, ToolSchema toolSchema)
go
NewLambdaTargetConfiguration(LambdaFunction IFunction, ToolSchema ToolSchema)
Properties
lambdaFunctionIFunctionlambda_functionIFunctionlambdaFunctionIFunctionLambdaFunctionIFunctionLambdaFunctionIFunction #The Lambda function that implements the MCP server logic.
targetTypeMcpTargetTypetarget_typeMcpTargetTypetargetTypeMcpTargetTypeTargetTypeMcpTargetTypeTargetTypeMcpTargetType #The target type.
toolSchemaToolSchematool_schemaToolSchematoolSchemaToolSchemaToolSchemaToolSchemaToolSchemaToolSchema #The tool schema that defines the available tools.
Methods
bind(scope: Construct, gateway: IGateway): TargetConfigurationConfigdef bind(self, scope: Construct, gateway: IGateway) -> TargetConfigurationConfigpublic TargetConfigurationConfig bind(Construct scope, IGateway gateway)public TargetConfigurationConfig Bind(Construct scope, IGateway gateway)func Bind(Scope Construct, Gateway IGateway) TargetConfigurationConfig #Binds this configuration to a construct scope Sets up necessary permissions for the gateway to invoke the Lambda function.
2 parameters
Parameters
scopescopescopescopeScope— The construct scope.gatewaygatewaygatewaygatewayGateway— The gateway that will use this target.
create(lambdaFunction: IFunction, toolSchema: ToolSchema): LambdaTargetConfiguration // chainable@staticmethod def create(lambda_function: IFunction, tool_schema: ToolSchema) -> LambdaTargetConfigurationpublic static LambdaTargetConfiguration create(IFunction lambdaFunction, ToolSchema toolSchema)public static LambdaTargetConfiguration Create(IFunction lambdaFunction, ToolSchema toolSchema)func Create(LambdaFunction IFunction, ToolSchema ToolSchema) LambdaTargetConfiguration static #Create a Lambda target configuration.
2 parameters · returns
Parameters
lambdaFunctionlambda_functionlambdaFunctionlambdaFunctionLambdaFunction— The Lambda function to invoke.toolSchematool_schematoolSchematoolSchemaToolSchema— The schema defining the tools.
Returns: A new LambdaTargetConfiguration instance