You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: custom header support for invoke and dev commands
Three fixes for custom header handling:
1. Allow empty requestHeaderAllowlist in add-agent flows: the TextInput
for header allowlist now accepts empty input (allowEmpty) so users
can press Enter to skip, matching the prompt text.
2. Add -H/--header flag to invoke command: repeatable flag that accepts
"Name: Value" pairs, normalizes header names with the AgentCore
prefix, and injects them via SDK middleware for deployed invocations.
Works for HTTP, MCP, and A2A protocols in both CLI and TUI modes.
3. Add -H/--header flag to dev command: same flag format, threaded
through all local dev invoke paths (streaming, non-streaming, MCP
tool calls, A2A) in both non-interactive and TUI modes.
.option('-l, --logs','Run dev server with logs to stdout [non-interactive]')
133
134
.option('--tool <name>','MCP tool name (used with --invoke call-tool)')
134
135
.option('--input <json>','MCP tool arguments as JSON (used with --invoke call-tool)')
136
+
.option('-H, --header <header>','Custom header to forward to the agent (format: "Name: Value", repeatable)',(val: string,prev: string[])=>[...prev,val],[]asstring[])
135
137
.action(asyncopts=>{
136
138
try{
137
139
constport=parseInt(opts.port,10);
138
140
141
+
// Parse custom headers
142
+
letheaders: Record<string,string>|undefined;
143
+
if(opts.header&&opts.header.length>0){
144
+
headers=parseHeaderFlags(opts.header);
145
+
}
146
+
139
147
// If --invoke provided, call the dev server and exit
.option('--stream','Stream response in real-time (TUI streams by default) [non-interactive]')
104
105
.option('--tool <name>','MCP tool name (use with "call-tool" prompt) [non-interactive]')
105
106
.option('--input <json>','MCP tool arguments as JSON (use with --tool) [non-interactive]')
107
+
.option('-H, --header <header>','Custom header to forward to the agent (format: "Name: Value", repeatable)',(val: string,prev: string[])=>[...prev,val],[]asstring[])
0 commit comments