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

# tools

# `marvin.utilities.tools`

## Constants

### `T`

```python theme={null}
T = TypeVar('T')
```

## Classes

### `ResultTool`

```python theme={null}
class ResultTool(type: Literal['result-tool'] = 'result-tool')
```

**Methods:**

* **`run`**
  ```python theme={null}
  def run(self, ctx: RunContext)
  ```

## Functions

### `update_fn`

```python theme={null}
def update_fn(func: Callable[..., T] | None = None, name: str | None = None, description: str | None = None) -> Callable[[Callable[..., T]], Callable[..., T]] | Callable[..., T]
```

Update a function's name and optionally set its docstring.

Can be used either as a decorator with keyword arguments or as a direct function.

Args:
func: The function to update (optional). If provided, updates are applied directly.
If not provided, returns a decorator.
name: The new name for the function (optional). If provided, must not be empty.
description: Optional docstring for the function

Example:

# As a function:

def my\_fn(x):
return x
updated\_fn = update\_fn(my\_fn, name='hello\_there')

# As a decorator with name:

@update\_fn(name='hello\_there')
def my\_fn(x):
return x

# As a decorator with name and description:

@update\_fn(name='hello\_there', description='Says hello')
def my\_fn(x):
return x

# As a decorator with no arguments:

@update\_fn()
def my\_fn(x):
return x

# Works with async functions too:

@update\_fn(name='async\_hello')
async def my\_async\_fn(x):
return x

### `wrap_tool_errors`

```python theme={null}
def wrap_tool_errors(tool_fn: Callable[..., Any])
```

Pydantic AI doesn't catch errors except for ModelRetry, so we need to make
sure we catch them ourselves and raise a ModelRetry instead.

***

**Parent Module:** [`utilities`](marvin-utilities)
