# Tool calling

AiBrow supports tool calling; you need to ensure you use a model and prompt that both support tool calling

```javascript
const session = await aibrow.LanguageModel.create({
  model: "https://huggingface.co/unsloth/Qwen3-8B-GGUF/resolve/main/Qwen3-8B-UD-Q4_K_XL.gguf",
  tools: [
    {
      name: "getWeather",
      description: "Get the weather in a location.",
      inputSchema: {
        type: "object",
        properties: {
          location: {
            type: "string",
            description: "The city to check for the weather condition.",
          },
        },
        required: ["location"],
      },
      async execute({ location }) {
        // Mock a http weather call
        await new Promise((resolve) => setTimeout(resolve,1000))
        return JSON.stringify({
          location,
          forecast: "Sunny, with a low chance of rain in the afternoon"
        })
      }
    }
  ]
})

await session.prompt("What is the weather in London?");
```


---

# Agent Instructions: 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:

```
GET https://docs.aibrow.ai/examples/tool-calling.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
