Skip to main content

UseAwsTool

Struct UseAwsTool 

Source
pub struct UseAwsTool { /* private fields */ }
Expand description

Tool for making AWS API calls using SigV4 signing.

This tool provides a universal interface to AWS services, allowing agents to invoke any AWS API operation dynamically. It supports:

  • All AWS services accessible via JSON-based APIs
  • Multiple credential sources (environment, profiles, IAM roles, SSO)
  • SigV4 request signing for authentication
  • Automatic region-specific endpoint resolution
  • Extensible service target prefix configuration

§Construction

This tool requires async initialization due to AWS credential loading. Use UseAwsTool::new().await or UseAwsTool::builder()...build().await.

Note: Unlike other tools in this crate, UseAwsTool does not implement Default because it requires async credential loading. Attempting to use an uninitialized tool will result in credential errors.

§Safety

Operations that match mutative prefixes (Create, Delete, Update, etc.) will include a warning in the output. The calling application should implement appropriate confirmation mechanisms.

Implementations§

Source§

impl UseAwsTool

Source

pub async fn new() -> Result<Self, ToolError>

Create a new UseAwsTool with default configuration.

This loads credentials from the default AWS credential chain:

  1. Environment variables (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
  2. Shared credentials file (~/.aws/credentials)
  3. IAM instance profile (on EC2)
  4. Container credentials (in ECS/Fargate)
  5. SSO credentials (if configured)
§Errors

Returns an error if no AWS credentials are found.

Source

pub fn builder() -> UseAwsToolBuilder

Create a builder for custom configuration.

Trait Implementations§

Source§

impl Tool for UseAwsTool

Source§

type Input = UseAwsInput

The input type for this tool. Must implement Deserialize and JsonSchema.
Source§

fn name(&self) -> &str

The name of the tool (e.g., “read_file”, “calculator”)
Source§

fn description(&self) -> &str

A description of what the tool does
Source§

async fn execute(&self, input: Self::Input) -> Result<ToolResult, ToolError>

Execute the tool with typed input
Source§

fn format_output_plain(&self, result: &ToolResult) -> String

Format tool output as plain text. Read more
Source§

fn format_output_ansi(&self, result: &ToolResult) -> String

Format tool output with ANSI colors. Read more
Source§

fn format_output_markdown(&self, result: &ToolResult) -> String

Format tool output as Markdown. Read more
Source§

fn input_schema(&self) -> Value

Get the JSON schema for this tool’s input. Read more
Source§

fn format_input_plain(&self, params: &Value) -> String

Format tool input as plain text (for JIRA, logs, copy/paste). Read more
Source§

fn format_input_ansi(&self, params: &Value) -> String

Format tool input with ANSI colors (for terminal display). Read more
Source§

fn format_input_markdown(&self, params: &Value) -> String

Format tool input as Markdown (for docs, GitHub, rendered UIs). Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more