> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ardent.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Tool

The `Tool` class defines a tool that can be attached to an [Agent](/reference/agent).

```ts theme={null}
import { Tool } from '@ardent-ai/sdk';

const reverse = new Tool({
  name: 'reverse',
  description: 'Reverse a string of text',
  parameters: {
    text: z.string()
  },
  result: z.string(),
  async execute({ text }) {
    return text.split('').reverse().join('');
  }
});
```

## Constructor

The `Tool` constructor accepts a configuration object with the following properties:

<ParamField path="name" type="string" required>
  The name of the tool. Must be alphanumeric.
</ParamField>

<ParamField path="description" type="string" required>
  A plain-text description of what the tool does. This should be as expressive as possible,
  to help explain to your agent what the tool can be used for.
</ParamField>

<ParamField path="parameters" type="{string: ZodSchema}">
  An optional hash of parameters, each of which should be a Zod schema describing the parameter's type.
  Your agent will use these schemas to determine the right format in which to pass arguments to the tool.
  If you omit this, your tool will receive no arguments.
</ParamField>

<ParamField path="result" type="ZodSchema">
  An optional Zod schema describing the type of the value returned by the tool's `execute()` function.
  If you omit this, your tool can return a value of any type.
</ParamField>

<ParamField path="execute" type="({string: any}, Context) -> any">
  The function which will be called when your agent decides to use the tool. The function
  receives two arguments:

  * A hash of arguments matching the shape specified in `parameters`.
  * A [Context](/reference/platform/overview) which provides access to platform functionality.

  This function should return a value of the shape described by the `result` schema.
</ParamField>
