Skip to content

Commit e18fce6

Browse files
authored
chore: copy changes for mcp release (#1404)
1 parent f0b5a0a commit e18fce6

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

crates/q_chat/src/lib.rs

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -199,14 +199,17 @@ const SMALL_SCREEN_WECLOME_TEXT: &str = color_print::cstr! {"
199199
<em>Welcome to <cyan!>Amazon Q</cyan!>!</em>
200200
"};
201201

202-
const ROTATING_TIPS: [&str; 7] = [
202+
const ROTATING_TIPS: [&str; 8] = [
203203
color_print::cstr! {"You can use <green!>/editor</green!> to edit your prompt with a vim-like experience"},
204204
color_print::cstr! {"You can execute bash commands by typing <green!>!</green!> followed by the command"},
205205
color_print::cstr! {"Q can use tools without asking for confirmation every time. Give <green!>/tools trust</green!> a try"},
206206
color_print::cstr! {"You can programmatically inject context to your prompts by using hooks. Check out <green!>/context hooks help</green!>"},
207207
color_print::cstr! {"You can use <green!>/compact</green!> to replace the conversation history with its summary to free up the context space"},
208208
color_print::cstr! {"<green!>/usage</green!> shows you a visual breakdown of your current context window usage"},
209209
color_print::cstr! {"If you want to file an issue to the Q CLI team, just tell me, or run <green!>q issue</green!>"},
210+
color_print::cstr! {"You can enable custom tools with <green!>MCP servers</green!>.\
211+
\nPlace a mcp config in ~/.aws/amazonq/mcp.json or /your/current/workspace/.amazonq/mcp.json.\
212+
\nLearn more at https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/what-is.html"},
210213
];
211214

212215
const GREETING_BREAK_POINT: usize = 67;
@@ -263,6 +266,9 @@ const HELP_TEXT: &str = color_print::cstr! {"
263266
<em>hooks</em> <black!>View and manage context hooks</black!>
264267
<em>/usage</em> <black!>Show current session's context window usage</black!>
265268
269+
<cyan,em>MCP:</cyan,em>
270+
<black!>You can now configure the Amazon Q CLI to use MCP servers. \nLearn how: https://docs.aws.amazon.com/en_us/amazonq/latest/qdeveloper-ug/command-line-mcp.html</black!>
271+
266272
<cyan,em>Tips:</cyan,em>
267273
<em>!{command}</em> <black!>Quickly execute a command in your current session</black!>
268274
<em>Ctrl(^) + j</em> <black!>Insert new-line to provide multi-line prompt. Alternatively, [Alt(⌥) + Enter(⏎)]</black!>
@@ -273,7 +279,8 @@ const HELP_TEXT: &str = color_print::cstr! {"
273279

274280
const RESPONSE_TIMEOUT_CONTENT: &str = "Response timed out - message took too long to generate";
275281
const TRUST_ALL_TEXT: &str = color_print::cstr! {"<green!>All tools are now trusted (<red!>!</red!>). Amazon Q will execute tools <bold>without</bold> asking for confirmation.\
276-
\nAgents can sometimes do unexpected things so understand the risks.</green!>"};
282+
\nAgents can sometimes do unexpected things so understand the risks.</green!>
283+
\nLearn more at https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-chat-security.html#command-line-chat-trustall-safety"};
277284

278285
const TOOL_BULLET: &str = " ● ";
279286
const CONTINUATION_LINE: &str = " ⋮ ";
@@ -337,10 +344,21 @@ pub async fn chat(
337344
_ => StreamingClient::new().await?,
338345
};
339346

340-
let mcp_server_configs = McpServerConfig::load_config(&mut output).await.unwrap_or_else(|e| {
341-
warn!("No mcp server config loaded: {}", e);
342-
McpServerConfig::default()
343-
});
347+
let mcp_server_configs = match McpServerConfig::load_config(&mut output).await {
348+
Ok(config) => {
349+
execute!(
350+
output,
351+
style::Print(
352+
"To learn more about MCP safety, see https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-security.html\n"
353+
)
354+
)?;
355+
config
356+
},
357+
Err(e) => {
358+
warn!("No mcp server config loaded: {}", e);
359+
McpServerConfig::default()
360+
},
361+
};
344362

345363
// If profile is specified, verify it exists before starting the chat
346364
if let Some(ref profile_name) = profile {
@@ -3002,14 +3020,8 @@ impl ChatContext {
30023020
}
30033021

30043022
// Set spinner after showing all of the assistant text content so far.
3005-
if let (Some(name), true) = (&tool_name_being_recvd, self.interactive) {
3006-
queue!(
3007-
self.output,
3008-
style::SetForegroundColor(Color::Blue),
3009-
style::Print(format!("\n{name}: ")),
3010-
style::SetForegroundColor(Color::Reset),
3011-
cursor::Hide,
3012-
)?;
3023+
if let (Some(_name), true) = (&tool_name_being_recvd, self.interactive) {
3024+
queue!(self.output, cursor::Hide)?;
30133025
self.spinner = Some(Spinner::new(Spinners::Dots, "Thinking...".to_string()));
30143026
}
30153027

0 commit comments

Comments
 (0)