# Update tool

> PUT https://api.nabrah.ai/api/ext/tool/{tool_id}

Group: Tools. Page: https://www.nabrah.ai/en/docs/api-reference/tools/update-tool

Update an existing tool in the current project. Send the fields you want to change in the request body; the tool is identified by the tool_id path parameter. When you include parameters, provide the full intended set, since it replaces the tool's parameter list. The response returns the updated tool record. Authenticated with your API key.

## Request fields

All fields are optional; only the ones you send are changed.

- **Editable fields**: name, description, url, method, and timeout_seconds behave exactly as on create. parameters replaces the tool's full parameter list when supplied — to keep existing parameters, include them in the array. Fields: `name`, `description`, `url`, `method`, `timeout_seconds`, `parameters`.
- **parameters[] entry**: Same shape as on create: name, location (query/header/path/body), parameter_type (constant or inferred), data_type, description, required, value (for constant parameters), and default_value. Fields: `name`, `location`, `parameter_type`, `data_type`, `description`, `required`, `value`, `default_value`.

## Delivery and retries

How Nabrah calls your endpoint during a call or chat.

- **One attempt per use**: Each time the agent uses the tool, Nabrah calls your endpoint once and waits up to `timeout_seconds`. There is no automatic retry or backoff, and no request ID is sent. Fields: `timeout_seconds`.
- **Errors**: Your status code and response body are passed back to the agent, which decides what to tell the caller. On a timeout or connection error the agent is told the tool failed. The agent may call the tool again in the same conversation, so make booking-style endpoints idempotent, for example by keying them on your own appointment ID.

## Authorization

- `X-API-Key` (string, header, required): your workspace API key.

## Path parameters

- `tool_id` (string, required): The ID of the tool to update. Obtain it from GET /api/ext/tool (the id field) or from the response of POST /api/ext/tool.

## Body (application/json)

### Example: Update description & timeout

Rename and re-document the tool and raise its timeout, keeping a single parameter.

```json
{
  "name": "get_weather",
  "description": "Look up current weather conditions for a given city.",
  "url": "https://api.example.com/weather",
  "method": "GET",
  "timeout_seconds": 10,
  "parameters": [
    {
      "name": "city",
      "location": "query",
      "parameter_type": "inferred",
      "data_type": "string",
      "description": "The city the caller is asking about",
      "required": true,
      "value": "",
      "default_value": "Riyadh"
    }
  ]
}
```

## Response

### 200 Successful Response

Content type: `application/json`

```json
{
  "name": "string",
  "description": "string",
  "url": "string",
  "method": "GET",
  "id": "00000000-0000-4000-8000-000000000000",
  "project_id": "00000000-0000-4000-8000-000000000000",
  "created_at": "2026-01-15T12:00:00.000Z",
  "updated_at": "2026-01-15T12:00:00.000Z",
  "timeout_seconds": 5,
  "parameters": [
    {
      "name": "string",
      "location": "query",
      "parameter_type": "constant",
      "data_type": "string",
      "description": "string",
      "tool_id": "00000000-0000-4000-8000-000000000000",
      "required": false,
      "value": "string",
      "default_value": "string"
    }
  ],
  "link_id": "00000000-0000-4000-8000-000000000000"
}
```

### 422 Validation Error

Content type: `application/json`

```json
{
  "detail": [
    {
      "loc": [
        "string"
      ],
      "msg": "string",
      "type": "string"
    }
  ]
}
```

## Request examples

### cURL

```bash
curl --request PUT \
  --url 'https://api.nabrah.ai/api/ext/tool/<tool_id>' \
  --header 'X-API-Key: <your-api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "get_weather",
  "description": "Look up current weather conditions for a given city.",
  "url": "https://api.example.com/weather",
  "method": "GET",
  "timeout_seconds": 10,
  "parameters": [
    {
      "name": "city",
      "location": "query",
      "parameter_type": "inferred",
      "data_type": "string",
      "description": "The city the caller is asking about",
      "required": true,
      "value": "",
      "default_value": "Riyadh"
    }
  ]
}'
```

### Python

```python
import requests

url = "https://api.nabrah.ai/api/ext/tool/<tool_id>"
headers = {
    "X-API-Key": "<your-api-key>",
}
payload = {
    "name": "get_weather",
    "description": "Look up current weather conditions for a given city.",
    "url": "https://api.example.com/weather",
    "method": "GET",
    "timeout_seconds": 10,
    "parameters": [
        {
            "name": "city",
            "location": "query",
            "parameter_type": "inferred",
            "data_type": "string",
            "description": "The city the caller is asking about",
            "required": True,
            "value": "",
            "default_value": "Riyadh"
        }
    ]
}

response = requests.put(url, headers=headers, json=payload)
response.raise_for_status()
print(response.json())
```

### JavaScript

```javascript
const response = await fetch("https://api.nabrah.ai/api/ext/tool/<tool_id>", {
  method: "PUT",
  headers: {
    "X-API-Key": "<your-api-key>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "name": "get_weather",
    "description": "Look up current weather conditions for a given city.",
    "url": "https://api.example.com/weather",
    "method": "GET",
    "timeout_seconds": 10,
    "parameters": [
      {
        "name": "city",
        "location": "query",
        "parameter_type": "inferred",
        "data_type": "string",
        "description": "The city the caller is asking about",
        "required": true,
        "value": "",
        "default_value": "Riyadh"
      }
    ]
  }),
});

const data = await response.json();
console.log(data);
```

### Go

```go
package main

import (
	"fmt"
	"io"
	"net/http"
	"strings"
)

func main() {
	payload := strings.NewReader(`{
  "name": "get_weather",
  "description": "Look up current weather conditions for a given city.",
  "url": "https://api.example.com/weather",
  "method": "GET",
  "timeout_seconds": 10,
  "parameters": [
    {
      "name": "city",
      "location": "query",
      "parameter_type": "inferred",
      "data_type": "string",
      "description": "The city the caller is asking about",
      "required": true,
      "value": "",
      "default_value": "Riyadh"
    }
  ]
}`)

	req, _ := http.NewRequest("PUT", "https://api.nabrah.ai/api/ext/tool/<tool_id>", payload)
	req.Header.Set("X-API-Key", "<your-api-key>")
	req.Header.Set("Content-Type", "application/json")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	out, _ := io.ReadAll(res.Body)
	fmt.Println(string(out))
}
```
