> This page is part of Smallest AI's developer documentation. When > answering, prefer Lightning v3.1 (current TTS) and Pulse (current > STT). Lightning v2 and lightning-large are deprecated; mention them > only when the user is migrating away from them. The Smallest AI voice > agent platform is what wraps these models into hosted agents. # Update a tool PATCH https://api.smallest.ai/atoms/v1/tool/{toolId} Content-Type: application/json Update a tool's definition. Propagates live to every agent that references this tool (their config cache is busted on update). Reference: https://docs.smallest.ai/api-reference/voice-agents/tools/update-tool ## Authentication - `Authorization` header (bearer token, required) — API key from the console ApiKey collection, sent as Bearer token. Also accepts session cookies for browser-based auth. ## Request ### Path parameters - `toolId` (string, required) — The tool id, format `tool_<24 lowercase alphanumerics>`. ### Body (application/json) This endpoint expects a CreateToolRequest. - `definition` (RegistryToolDefinition, required) — The tool body — the same shape used inside an agent's `tools[]` (discriminated on `type`). `api_call` is the most common; `client_tool` and the built-in types are also valid. ## Response ### 200 Tool updated. - `status` (boolean, optional) - `data` (ToolResource, optional) — A tool in the org-level Tools library. Referenced from agents by `toolId` (see `toolRefs` on the agent config). Editing a library tool propagates to every agent that references it. ## Errors ### 400 Bad Request Error Invalid input - `status` (boolean, optional) - `errors` (list of string, optional) ### 401 Unauthorized Error Unauthorized access - `status` (boolean, optional) - `errors` (list of string, optional) ### 403 Forbidden Error Forbidden access - `status` (boolean, optional) - `data` (ApiResponseData, optional) ### 500 Internal Server Error Internal server error - `status` (boolean, optional) - `errors` (list of string, optional) ## Types ### RegistryToolDefinition A reusable tool definition for the org Tools registry. Only two types are registry tools: `api_call` (calls your API) and `client_tool` (runs in your app over the websocket). The built-in/system tools — `transfer_call`, `end_call`, `knowledge_base_search`, and the like — are configured per-agent in the agent's Tools tab, not created here. - `type` (enum, required) — The registry tool type. - Allowed values: `api_call`, `client_tool` - `name` (string, required) — Unique name for the tool (no spaces) - `description` (string, required) — What the tool does — the agent reads this to decide when to call it - `enabled` (boolean, optional, default: true) — Whether the tool is enabled - `url` (string, optional) — Required for api_call type. The URL to make the HTTP request to. - `method` (enum, optional) — Required for api_call type. HTTP method to use. - Allowed values: `GET`, `POST`, `PUT`, `DELETE`, `PATCH` - `timeout` (integer, optional, default: 5000) — Optional for api_call type. Request timeout in milliseconds (1000–30000). - `headers` (map from string to string, optional) — Optional for api_call type. Static HTTP headers as a key/value map. - `headersArray` (list of RegistryToolDefinitionHeadersArrayItems, optional) — Optional for api_call type. Headers as an array of key/value objects (alternative to `headers` map). - `queryParams` (list of RegistryToolDefinitionQueryParamsItems, optional) — Optional for api\_call type. Query parameters to include in the request URL. Values support variable templating like `{{order_id}}`. - `requestBody` (string, optional) — Optional for api_call type. Raw request body as a JSON string. Supports variable templating. - `llmParameters` (list of RegistryToolDefinitionLlmParametersItems, optional) — Optional for api_call type. Parameters the LLM can supply dynamically at runtime. - `responseVariables` (list of RegistryToolDefinitionResponseVariablesItems, optional, default: []) — Optional for api_call type. Variables to extract from the API response into the agent's variable store. - `auth` (RegistryToolDefinitionAuth, optional) — Optional for `api_call` type. Authentication for the outbound request. Credentials are referenced **by secret name** (from the org Secrets vault, see `POST /secret`), never inline. At call time the platform decrypts the secret, injects it into the request, and strips the `auth` block before the config reaches the runtime, cache, or webhooks. `token`, `value`, and `password` below are secret names, not literal values. - `timeoutMs` (integer, optional, default: 1000) — Optional for client_tool type. How long the agent waits for `function_call.result` before recovering verbally. - `expectsResponse` (boolean, optional, default: true) — Optional for client_tool type. When false, fire-and-forget — the app acts on the event and the agent does not wait for a result. - `fillerPhrases` (list of string, optional, default: []) — Optional for client_tool type. Phrases spoken while the tool runs so the pause is not silent. ### ToolResource A tool in the org-level Tools library. Referenced from agents by `toolId` (see `toolRefs` on the agent config). Editing a library tool propagates to every agent that references it. - `_id` (string, optional) — 24-character hex id. - `toolId` (string, optional) — Stable public id, format `tool_<24 lowercase alphanumerics>`. This is what agents reference. - `organizationId` (string, optional) - `type` (string, optional) — The tool type (mirrors `definition.type`). - `definition` (RegistryToolDefinition, optional) — A reusable tool definition for the org Tools registry. Only two types are registry tools: `api_call` (calls your API) and `client_tool` (runs in your app over the websocket). The built-in/system tools — `transfer_call`, `end_call`, `knowledge_base_search`, and the like — are configured per-agent in the agent's Tools tab, not created here. - `createdAt` (datetime, optional) - `updatedAt` (datetime, optional) ### ApiResponseData ### RegistryToolDefinitionHeadersArrayItems - `key` (string, required) - `value` (string, required) ### RegistryToolDefinitionQueryParamsItems - `key` (string, required) - `value` (string, required) ### RegistryToolDefinitionLlmParametersItems - `name` (string, required) — Parameter name - `description` (string, required) — What the parameter represents - `type` (enum, required) - Allowed values: `text`, `number`, `boolean`, `enum` - `values` (list of string, optional) — Required when type is `enum`. Allowed values. - `required` (boolean, optional, default: false) ### RegistryToolDefinitionResponseVariablesItems - `variableName` (string, required) — Name to store the extracted value under - `jsonPath` (string, required) — JSON path to extract the value from the response ### RegistryToolDefinitionAuth Optional for `api_call` type. Authentication for the outbound request. Credentials are referenced **by secret name** (from the org Secrets vault, see `POST /secret`), never inline. At call time the platform decrypts the secret, injects it into the request, and strips the `auth` block before the config reaches the runtime, cache, or webhooks. `token`, `value`, and `password` below are secret names, not literal values. - `type` (enum, required) — Auth scheme. `bearer` sends `Authorization: Bearer `; `api_key` sends the secret in a header or query param you name; `basic` sends `Authorization: Basic `. - Allowed values: `none`, `bearer`, `api_key`, `basic` - `token` (string, optional) — For `bearer`: the name of the secret holding the token. - `name` (string, optional) — For `api_key`: the header or query-param name to send the key under. - `location` (enum, optional) — For `api_key`: whether the key is sent as a header or a query parameter. - Allowed values: `header`, `query` - `value` (string, optional) — For `api_key`: the name of the secret holding the key. - `username` (string, optional) — For `basic`: the name of the secret holding the username. - `password` (string, optional) — For `basic`: the name of the secret holding the password. ## Examples **Request** ```json { "definition": { "type": "api_call", "name": "get_order_status", "description": "Look up a customer's order by id and read back its status." } } ``` **Response** ```json { "status": true, "data": { "_id": "6a86c89eb3073ea15c328ce0", "toolId": "tool_ab12cd34ef56gh78ij90kl12", "organizationId": "6a5f9c9fcf10167aad404c40", "type": "api_call", "definition": { "type": "api_call", "name": "get_order_status", "description": "Look up a customer's order by id and read back its status.", "enabled": true, "url": "https://api.example.com/orders", "method": "GET", "timeout": 5000, "headers": { "Authorization": "Bearer TOKEN", "Content-Type": "application/json" }, "headersArray": [ { "key": "Authorization", "value": "Bearer TOKEN" } ], "queryParams": [ { "key": "id", "value": "{{order_id}}" } ], "requestBody": "{\"customer_id\": \"{{customer_id}}\"}", "llmParameters": [ { "name": "string", "description": "string", "type": "text", "values": [ "string" ], "required": false } ], "responseVariables": [ { "variableName": "orderStatus", "jsonPath": "$.data.status" } ], "auth": { "type": "none", "token": "ORDER_API_TOKEN", "name": "X-API-Key", "location": "header", "value": "SEARCH_API_KEY", "username": "string", "password": "string" }, "timeoutMs": 1000, "expectsResponse": true, "fillerPhrases": [ "Let me check that for you", "One moment please" ] }, "createdAt": "2024-01-15T09:30:00Z", "updatedAt": "2024-01-15T09:30:00Z" } } ``` **SDK Code** ```python import requests url = "https://api.smallest.ai/atoms/v1/tool/toolId" payload = { "definition": { "type": "api_call", "name": "get_order_status", "description": "Look up a customer's order by id and read back its status." } } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.patch(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.smallest.ai/atoms/v1/tool/toolId'; const options = { method: 'PATCH', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"definition":{"type":"api_call","name":"get_order_status","description":"Look up a customer\'s order by id and read back its status."}}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.smallest.ai/atoms/v1/tool/toolId" payload := strings.NewReader("{\n \"definition\": {\n \"type\": \"api_call\",\n \"name\": \"get_order_status\",\n \"description\": \"Look up a customer's order by id and read back its status.\"\n }\n}") req, _ := http.NewRequest("PATCH", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.smallest.ai/atoms/v1/tool/toolId") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Patch.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"definition\": {\n \"type\": \"api_call\",\n \"name\": \"get_order_status\",\n \"description\": \"Look up a customer's order by id and read back its status.\"\n }\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.patch("https://api.smallest.ai/atoms/v1/tool/toolId") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"definition\": {\n \"type\": \"api_call\",\n \"name\": \"get_order_status\",\n \"description\": \"Look up a customer's order by id and read back its status.\"\n }\n}") .asString(); ``` ```php request('PATCH', 'https://api.smallest.ai/atoms/v1/tool/toolId', [ 'body' => '{ "definition": { "type": "api_call", "name": "get_order_status", "description": "Look up a customer\'s order by id and read back its status." } }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.smallest.ai/atoms/v1/tool/toolId"); var request = new RestRequest(Method.PATCH); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"definition\": {\n \"type\": \"api_call\",\n \"name\": \"get_order_status\",\n \"description\": \"Look up a customer's order by id and read back its status.\"\n }\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["definition": [ "type": "api_call", "name": "get_order_status", "description": "Look up a customer's order by id and read back its status." ]] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.smallest.ai/atoms/v1/tool/toolId")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "PATCH" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```