Skip to content

Commit 9d449df

Browse files
authored
fix: standalone argument for use aws (#733)
1 parent eb34f4d commit 9d449df

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

crates/q_cli/src/cli/chat/tools/tool_index.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
},
7272
"use_aws": {
7373
"name": "use_aws",
74-
"description": "Make an AWS CLI api call with the specified service, operation, and parameters. All arguments MUST conform to the AWS CLI specification.",
74+
"description": "Make an AWS CLI api call with the specified service, operation, and parameters. All arguments MUST conform to the AWS CLI specification. Should the output of the invocation indicate a malformed command, invoke help to obtain the the correct command.",
7575
"input_schema": {
7676
"type": "object",
7777
"properties": {
@@ -85,7 +85,7 @@
8585
},
8686
"parameters": {
8787
"type": "object",
88-
"description": "The parameters for the operation. The parameter keys MUST conform to the AWS CLI specification. You should prefer to use JSON Syntax over shorthand syntax wherever possible."
88+
"description": "The parameters for the operation. The parameter keys MUST conform to the AWS CLI specification. You should prefer to use JSON Syntax over shorthand syntax wherever possible. For parameters that are booleans, prioritize using flags with no value. Denote these flags with flag names as key and an empty string as their value. You should also prefer kebab case."
8989
},
9090
"region": {
9191
"type": "string",

crates/q_cli/src/cli/chat/tools/use_aws.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ impl UseAws {
5252
command.arg(&self.service_name).arg(&self.operation_name);
5353
if let Some(parameters) = self.cli_parameters() {
5454
for (name, val) in parameters {
55-
command.arg(name).arg(val);
55+
command.arg(name);
56+
if !val.is_empty() {
57+
command.arg(val);
58+
}
5659
}
5760
}
5861
let output = command
@@ -110,7 +113,14 @@ impl UseAws {
110113
if let Some(parameters) = &self.parameters {
111114
queue!(updates, style::Print("Parameters: \n".to_string()))?;
112115
for (name, value) in parameters {
113-
queue!(updates, style::Print(format!("- {}: {}\n", name, value)))?;
116+
match value {
117+
serde_json::Value::String(s) if s.is_empty() => {
118+
queue!(updates, style::Print(format!("- {}\n", name)))?;
119+
},
120+
_ => {
121+
queue!(updates, style::Print(format!("- {}: {}\n", name, value)))?;
122+
},
123+
}
114124
}
115125
}
116126

0 commit comments

Comments
 (0)