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

Method invoke

crates/chat-cli/src/cli/chat/tools/mod.rs:146–167  ·  view source on GitHub ↗

Invokes the tool asynchronously

(
        &self,
        os: &Os,
        stdout: &mut impl Write,
        line_tracker: &mut HashMap<String, FileLineTracker>,
        agents: &crate::cli::agent::Agents,
    )

Source from the content-addressed store, hash-verified

144
145 /// Invokes the tool asynchronously
146 pub async fn invoke(
147 &self,
148 os: &Os,
149 stdout: &mut impl Write,
150 line_tracker: &mut HashMap<String, FileLineTracker>,
151 agents: &crate::cli::agent::Agents,
152 ) -> Result<InvokeOutput> {
153 let active_agent = agents.get_active();
154 match self {
155 Tool::FsRead(fs_read) => fs_read.invoke(os, stdout).await,
156 Tool::FsWrite(fs_write) => fs_write.invoke(os, stdout, line_tracker).await,
157 Tool::ExecuteCommand(execute_command) => execute_command.invoke(os, stdout).await,
158 Tool::UseAws(use_aws) => use_aws.invoke(os, stdout).await,
159 Tool::Custom(custom_tool) => custom_tool.invoke(os, stdout).await,
160 Tool::GhIssue(gh_issue) => gh_issue.invoke(os, stdout).await,
161 Tool::Introspect(introspect) => introspect.invoke(os, stdout).await,
162 Tool::Knowledge(knowledge) => knowledge.invoke(os, stdout, active_agent).await,
163 Tool::Thinking(think) => think.invoke(stdout).await,
164 Tool::Todo(todo) => todo.invoke(os, stdout).await,
165 Tool::Delegate(delegate) => delegate.invoke(os, stdout, agents).await,
166 }
167 }
168
169 /// Queues up a tool's intention in a human readable format
170 pub async fn queue_description(&self, os: &Os, output: &mut ControlEnd<DestinationStdout>) -> Result<()> {

Callers 1

tool_use_executeMethod · 0.45

Calls 1

get_activeMethod · 0.80

Tested by

no test coverage detected