Bug description
In @aws/agentcore-cdk@0.1.0-alpha.45, setting enableSemanticSearch: false on a gateway makes Gateway.buildProtocolConfiguration emit:
{ "protocolConfiguration": { "mcp": { "searchType": "NONE" } } }
'NONE' is not a valid value for the AWS::BedrockAgentCore::Gateway searchType enum (only SEMANTIC is accepted), so the deploy fails:
ValidationException: ... failed validation constraint for keyword [enum] ...
The method's own docstring says "When semantic search is disabled, no protocol configuration is set." — but the implementation sends 'NONE' instead of omitting the block.
Reproduction
- Declare a gateway with
enableSemanticSearch: false.
- Synth/deploy.
- CloudFormation rejects the template with
ValidationException on searchType.
Why this matters
When an agent connects to two gateways that both have semantic search enabled, each gateway publishes the built-in x_amz_bedrock_agentcore_search tool, causing a duplicate tool-name collision at invocation time (e.g. in Strands). The natural fix is disabling semantic search on one gateway — which is exactly the code path that is broken.
Suggested fix
// dist/cdk/constructs/components/mcp/Gateway.js
buildProtocolConfiguration(gateway) {
if (gateway.enableSemanticSearch === false)
return undefined; // omit the block, as the docstring states
return {
mcp: { searchType: 'SEMANTIC' },
};
}
Verified locally via patch-package: with the block omitted, the gateway deploys successfully and the duplicate-tool collision is resolved.
Environment: @aws/agentcore-cdk@0.1.0-alpha.45, us-east-2.
patch-package diff
diff --git a/node_modules/@aws/agentcore-cdk/dist/cdk/constructs/components/mcp/Gateway.js b/node_modules/@aws/agentcore-cdk/dist/cdk/constructs/components/mcp/Gateway.js
index 00624cb..6bc4312 100644
--- a/node_modules/@aws/agentcore-cdk/dist/cdk/constructs/components/mcp/Gateway.js
+++ b/node_modules/@aws/agentcore-cdk/dist/cdk/constructs/components/mcp/Gateway.js
@@ -241,8 +241,10 @@ class Gateway extends constructs_1.Construct {
* Otherwise, configures MCP with SEMANTIC search type.
*/
buildProtocolConfiguration(gateway) {
+ if (gateway.enableSemanticSearch === false)
+ return undefined;
return {
- mcp: { searchType: gateway.enableSemanticSearch === false ? 'NONE' : 'SEMANTIC' },
+ mcp: { searchType: 'SEMANTIC' },
};
}
/**
Note: the repository field of @aws/agentcore-cdk points to aws/agentcore-l3-cdk-constructs, which returns 404 (private/unpublished), so I'm filing here in the CLI repo that scaffolds projects depending on this package. Happy to move this to the right repo if you point me to it.
Bug description
In
@aws/agentcore-cdk@0.1.0-alpha.45, settingenableSemanticSearch: falseon a gateway makesGateway.buildProtocolConfigurationemit:{ "protocolConfiguration": { "mcp": { "searchType": "NONE" } } }'NONE'is not a valid value for theAWS::BedrockAgentCore::GatewaysearchTypeenum (onlySEMANTICis accepted), so the deploy fails:The method's own docstring says "When semantic search is disabled, no protocol configuration is set." — but the implementation sends
'NONE'instead of omitting the block.Reproduction
enableSemanticSearch: false.ValidationExceptiononsearchType.Why this matters
When an agent connects to two gateways that both have semantic search enabled, each gateway publishes the built-in
x_amz_bedrock_agentcore_searchtool, causing a duplicate tool-name collision at invocation time (e.g. in Strands). The natural fix is disabling semantic search on one gateway — which is exactly the code path that is broken.Suggested fix
Verified locally via patch-package: with the block omitted, the gateway deploys successfully and the duplicate-tool collision is resolved.
Environment:
@aws/agentcore-cdk@0.1.0-alpha.45, us-east-2.patch-package diff
Note: the
repositoryfield of@aws/agentcore-cdkpoints toaws/agentcore-l3-cdk-constructs, which returns 404 (private/unpublished), so I'm filing here in the CLI repo that scaffolds projects depending on this package. Happy to move this to the right repo if you point me to it.