> ## Documentation Index
> Fetch the complete documentation index at: https://gaia-docs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Tool

> Updates an existing tool

## Path Parameters

<ParamField path="id" type="string" required>
  Tool ID
</ParamField>

## Request Body

<ParamField body="toolId" type="string" required>
  Tool ID (must match path parameter)
</ParamField>

<ParamField body="tool" type="object" required>
  Tool fields to update

  <Expandable title="properties">
    <ResponseField name="name" type="string">
      Tool name
    </ResponseField>

    <ResponseField name="description" type="string">
      Tool description
    </ResponseField>

    <ResponseField name="language" type="string">
      Programming language (`javascript` or `python`)
    </ResponseField>

    <ResponseField name="dependencies" type="array">
      List of dependencies
    </ResponseField>

    <ResponseField name="code" type="string">
      Tool code
    </ResponseField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Indicates if the operation was successful
</ResponseField>

<ResponseField name="message" type="string">
  Response message
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --request PUT \
    --url https://api.yourapp.com/api/tools/tool_123 \
    --header 'Authorization: Bearer <token>' \
    --header 'Content-Type: application/json' \
    --data '{
      "toolId": "tool_123",
      "tool": {
        "name": "Advanced Data Validator",
        "description": "Validates and sanitizes input data",
        "dependencies": ["lodash", "validator", "sanitize-html"]
      }
    }'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.yourapp.com/api/tools/tool_123', {
    method: 'PUT',
    headers: {
      'Authorization': 'Bearer <token>',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      toolId: 'tool_123',
      tool: {
        name: 'Advanced Data Validator',
        description: 'Validates and sanitizes input data',
        dependencies: ['lodash', 'validator', 'sanitize-html']
      }
    })
  });

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

  ```python Python theme={null}
  import requests

  url = "https://api.yourapp.com/api/tools/tool_123"
  headers = {
      "Authorization": "Bearer <token>",
      "Content-Type": "application/json"
  }
  payload = {
      "toolId": "tool_123",
      "tool": {
          "name": "Advanced Data Validator",
          "description": "Validates and sanitizes input data",
          "dependencies": ["pandas", "numpy", "validators"]
      }
  }

  response = requests.put(url, json=payload, headers=headers)
  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "message": "Tool updated successfully"
  }
  ```

  ```json Error Response theme={null}
  {
    "success": false,
    "message": "Unauthorized"
  }
  ```
</ResponseExample>
