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

# 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?");
```
