MCPcopy Create free account
hub / github.com/aws/amazon-q-developer-cli / print_tool_description

Method print_tool_description

crates/chat-cli/src/cli/chat/mod.rs:3504–3560  ·  view source on GitHub ↗
(&mut self, os: &Os, tool_index: usize, trusted: bool)

Source from the content-addressed store, hash-verified

3502 }
3503
3504 async fn print_tool_description(&mut self, os: &Os, tool_index: usize, trusted: bool) -> Result<(), ChatError> {
3505 let tool_use = &self.tool_uses[tool_index];
3506
3507 if self.stderr.should_send_structured_event {
3508 let tool_call_start = ToolCallStart {
3509 tool_call_id: tool_use.id.clone(),
3510 tool_call_name: tool_use.name.clone(),
3511 mcp_server_name: if let Tool::Custom(ref tool) = tool_use.tool {
3512 Some(tool.server_name.clone())
3513 } else {
3514 None
3515 },
3516 is_trusted: trusted,
3517 parent_message_id: None,
3518 };
3519 self.stdout.send(Event::ToolCallStart(tool_call_start))?;
3520 } else {
3521 queue!(
3522 self.stdout,
3523 StyledText::emphasis_fg(),
3524 style::Print(format!(
3525 "🛠️ Using tool: {}{}",
3526 tool_use.tool.display_name(),
3527 if trusted { " (trusted)".dark_green() } else { "".reset() }
3528 )),
3529 StyledText::reset(),
3530 )?;
3531 if let Tool::Custom(ref tool) = tool_use.tool {
3532 queue!(
3533 self.stdout,
3534 StyledText::reset(),
3535 style::Print(" from mcp server "),
3536 StyledText::emphasis_fg(),
3537 style::Print(&tool.server_name),
3538 StyledText::reset(),
3539 )?;
3540 }
3541
3542 execute!(
3543 self.stdout,
3544 style::Print("\n"),
3545 style::Print(CONTINUATION_LINE),
3546 style::Print("\n"),
3547 style::Print(TOOL_BULLET)
3548 )?;
3549 }
3550
3551 tool_use
3552 .tool
3553 .queue_description(os, &mut self.stdout)
3554 .await
3555 .map_err(|e| ChatError::Custom(format!("failed to print tool, `{}`: {}", tool_use.name, e).into()))?;
3556
3557 self.stdout.flush()?;
3558
3559 Ok(())
3560 }
3561

Callers 1

tool_use_executeMethod · 0.80

Calls 6

ToolCallStartClass · 0.85
CustomClass · 0.85
cloneMethod · 0.45
sendMethod · 0.45
queue_descriptionMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected