# `LangChain.Message.ToolResult`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.0/lib/message/tool_result.ex#L1)

Represents a the result of running a requested tool. The LLM's requests a tool
use through a `ToolCall`. A `ToolResult` returns the answer or result from the
application back to the AI.

## Content
The `content` can be a string or a list of ContentParts for multi-modal
responses (text, images, etc.) that gets returned to the LLM as the result.

## Processed Content
The `processed_content` field is optional. When you want to keep the results
of the Elixir function call as a native Elixir data structure,
`processed_content` can hold it.

Advanced use: You can use the `options` field for LLM-specific features like
cache control.

To do this, the Elixir function's result should be a `{:ok, "String response
for LLM", native_elixir_data}`. See `LangChain.Function` for details and
examples.

# `t`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.0/lib/message/tool_result.ex#L54)

```elixir
@type t() :: %LangChain.Message.ToolResult{
  content: term(),
  display_text: term(),
  interrupt_data: term(),
  is_error: term(),
  is_interrupt: term(),
  name: term(),
  options: term(),
  processed_content: term(),
  tool_call_id: term(),
  type: term()
}
```

# `new`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.0/lib/message/tool_result.ex#L75)

```elixir
@spec new(attrs :: map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
```

Build a new ToolResult and return an `:ok`/`:error` tuple with the result.

# `new!`
[🔗](https://github.com/brainlid/langchain/blob/v0.8.0/lib/message/tool_result.ex#L87)

```elixir
@spec new!(attrs :: map()) :: t() | no_return()
```

Build a new ToolResult and return it or raise an error if invalid.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
