> For the complete documentation index, see [llms.txt](https://orpheus.ajac-zero.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://orpheus.ajac-zero.com/features/tool-calling.md).

# Tool Calling

For more advanced use cases, you will probably want to give the LLM a way to interact with its environment. Tool calling enables this by specifying a set of actions the model can take.

Orpheus supports tool calling via the `Tool` object builder, which you can then pass to the `tools` parameter of your request.

The response will then, if the model decides to use a tool, hold a vector of `ToolCall` objects that we can then use within our code.&#x20;

{% code title="empty\_tool.rs" %}

```rust
use orpheus::prelude::*;

fn main() {
    let client = Orpheus::from_env().unwrap();

    // Define a tool
    // For this example, it's just an empty tool we can use as a "switch".
    let my_tool = Tool::function("my_tool").empty();

    let res = client
        .chat("Call my tool")
        .model("openai/gpt-4o")
        .tools([my_tool]) // Pass an iterable of tools to the request
        .send()
        .unwrap();

    // `tool_calls` is a convenience method to
    // access tool calls in the response, if any
    if let Some(tool_calls) = res.tool_calls().unwrap() {
        for tool_call in tool_calls {
            println!("Tool call: {:?}", tool_call);
        }
    }
}
```

{% endcode %}

```
Tool call: Function { id: "call_dTmBXTw3BXhIbCL5r2dVvnnU", function: Function { name: "my_tool", arguments: "{}" } }
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://orpheus.ajac-zero.com/features/tool-calling.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
