feat(gateway-target): explicit --listing-mode flag for dynamic tool listing
- Dominant language
- TypeScript
- Stars
- 283
- Forks
- 95
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 183
Description
### Description
Dynamic tool listing on a Gateway Target is partially exposed in CFN today via `AWS::BedrockAgentCore::GatewayTarget.TargetConfiguration.Mcp.McpServer.ListingMode` — allowed values `DEFAULT | DYNAMIC`. With `DYNAMIC`, the gateway calls `tools/list` on the upstream MCP server at request time instead of caching a static list. Source: [McpServerTargetConfiguration CFN docs](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-bedrockagentcore-gatewaytarget-mcpservertargetconfiguration.md).
The CLI's schema marks `toolDefinitions` as optional for `mcpServer` targets (`src/schema/schemas/mcp.ts:346–347`) — this implicitly maps to `DYNAMIC` listing, but:
1. There is no explicit `--listing-mode` flag and no schema field in `AgentCoreGatewayTargetSchema` that maps to `ListingMode`.
2. The L3 construct does not pass `ListingMode` to `CfnGatewayTarget`; it relies entirely on the presence/absence of `toolDefinitions`.
3. There is **no CFN support** for Lambda-backed dynamic listing today — `McpLambdaTargetConfiguration` only takes `LambdaArn` + `ToolSchema` (`InlinePayload` or `S3` — both static). This is a service-side gap.
### Acceptance Criteria
- [ ] Add `listingMode?: 'DEFAULT' | 'DYNAMIC'` to the `mcpServer` discriminator in `AgentCoreGatewayTargetSchema`.
- [ ] Add `--listing-mode` flag to `agentcore add gateway-target --type mcpServer`.
- [ ] Surface listing-mode toggle in the TUI for MCP server targets.
- [ ] L3 construct passes the field through to `CfnGatewayTarget.TargetConfiguration.Mcp.McpServer.ListingMode`.
- [ ] Document that Lambda dynamic listing is NOT supported in CFN (and therefore the CLI) today; track service-team request for that capability.
- [ ] Snapshot tests updated.
### Additional Context
- CFN support: **PARTIAL** — `McpServer.ListingMode` only; Lambda dynamic listing is not modeled.
- L3 gap: yes — `@aws/agentcore-cdk` Gateway target construct needs to pass `ListingMode` explicitly.
- Lambda dynamic listing requires a service-side change (no `ListingMode` on `McpLambdaTargetConfiguration`); track separately with the service team.
- Reference: McpServerTargetConfiguration says "MCP resources for dynamic targets will be dynamically retrieved when listing tools".
Contributor guide
Research direction
Start with src/schema/schemas/mcp.ts:346–347 and trace the mcpServer configuration through the add gateway-target command, the MCP server TUI, and the L3 Gateway target construct. Update the snapshot tests named in the issue and verify that explicit DEFAULT or DYNAMIC values reach the CFN MCP configuration. Document the Lambda CFN limitation and track it separately with the service team.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, typescript
- Domain
- cli, cloud, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100