Skip to Content
Tools

Update an HTTP tool

Permissiontools:updateAuthentication
PATCH
/tools/{id}

Applies a partial update, validates the complete resulting request atomically, and returns the normalized tool. Slug is immutable. JSON null clears nullable description, body, and acknowledgment fields; null normalizes headers, parameters, and response_map to empty values.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Use a Voice API key or connected-app OAuth access token. Authentication.

Path Parameters

id*string
Formatuuid

Header Parameters

If-Match?string

Optional strong ETag (or *) from a prior response. A stale tag returns 412 without changing the resource.

Request Body

application/json
  1. body

Slug is immutable. Every supplied field is combined with current state, then the whole executable request is validated before any change is persisted.

Properties1 <= properties
name?string
Length1 <= length <= 200
description?|
Lengthlength <= 2000
mode?ToolMode
Value in"sync""async"
phase?ToolPhase

When the tool runs. in_call (the default, and every tool authored before this field existed) is invoked by the model during the conversation. pre_call fires once, before the agent speaks, with no model involvement: its parameters must be static, system, or secret cards, its templates may reference only {{system.NAME}}, {{vars.NAME}}, and {{secrets.NAME}}, and its response_map names the values it publishes as {{tools.SLUG.NAME}}. pre_call additionally requires mode: sync, default_reaction: speaks, and precomputable: false, because all three describe behaviour during a conversation that has not started yet.

Value in"in_call""pre_call"
method?ToolMethod
Value in"GET""POST""PUT""PATCH""DELETE"
url?string
Length1 <= length <= 4096
default_reaction?ToolReaction
Value in"speaks""listens"
precomputable?boolean
carry_across_calls?boolean
headers?|null
body?||

Templated string, templated JSON object, or null for no request body. Arrays and scalar JSON values other than strings are rejected.

parameters?array<||||>||null
response_map?|null
internal_slots?array<>|null
ack_response?|

Async-only agent-visible templated JSON object injected immediately while the real request continues; null disables it. It may use {{params.NAME}}, {{slots.NAME}}, {{system.NAME}}, and {{vars.NAME}}. It must never reference {{secrets.NAME}} at any nesting depth; public validation rejects the request rather than exposing a credential to the agent.

timeout_ms?integer
Range100 <= value <= 60000
retries?integer
Range0 <= value <= 5

Response Body

Updated tool, or the unchanged tool for a semantic no-op.

application/json
  1. response
id*string
Formatuuid
slug*string
name*string
description*string|null
mode*ToolMode
Value in"sync""async"
phase*ToolPhase

When the tool runs. in_call (the default, and every tool authored before this field existed) is invoked by the model during the conversation. pre_call fires once, before the agent speaks, with no model involvement: its parameters must be static, system, or secret cards, its templates may reference only {{system.NAME}}, {{vars.NAME}}, and {{secrets.NAME}}, and its response_map names the values it publishes as {{tools.SLUG.NAME}}. pre_call additionally requires mode: sync, default_reaction: speaks, and precomputable: false, because all three describe behaviour during a conversation that has not started yet.

Value in"in_call""pre_call"
method*ToolMethod
Value in"GET""POST""PUT""PATCH""DELETE"
url*string
default_reaction*ToolReaction
Value in"speaks""listens"
precomputable*boolean
carry_across_calls*boolean
timeout_ms*integer
retries*integer
archived_at*|
Formatdate-time
created_at*string
Formatdate-time
updated_at*string
Formatdate-time
headers*

Header templates. Host, Content-Length, Transfer-Encoding, Connection, Proxy-Authorization, Proxy-Authenticate, Proxy-Connection, Keep-Alive, TE, Trailer, and Upgrade are transport-controlled and forbidden. Values cannot contain CR/LF.

Propertiesproperties <= 100
body*||

Templated string, templated JSON object, or null for no request body. Arrays and scalar JSON values other than strings are rejected.

parameters*array<||||>|
response_map*

Map of destination slot name to the supported tiny JSONPath syntax, such as $.customer.name or $.items.0.id.

Propertiesproperties <= 100
internal_slots*array<>

Subset of response_map slot names whose captured value is withheld from the model. The slot is still filled and still usable in templated tool fields such as a later request body or URL, but its value is never placed in the conversation the model sees, so a tool may return an account number or a policy document without that text entering the transcript or a prompt. Every entry must be a key of response_map; an unknown name is a 422. Stored canonically (sorted and deduplicated); omitted or null means an empty list.

Itemsitems <= 100
ack_response*|

Async-only agent-visible templated JSON object injected immediately while the real request continues; null disables it. It may use {{params.NAME}}, {{slots.NAME}}, {{system.NAME}}, and {{vars.NAME}}. It must never reference {{secrets.NAME}} at any nesting depth; public validation rejects the request rather than exposing a credential to the agent.

Example Request
curl -X PATCH 'https://api.kejue.co/v1/tools/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "slug": "string",  "name": "string",  "description": "string",  "mode": "sync",  "phase": "in_call",  "method": "GET",  "url": "string",  "default_reaction": "speaks",  "precomputable": true,  "carry_across_calls": true,  "timeout_ms": 0,  "retries": 0,  "archived_at": "2019-08-24T14:15:22Z",  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z",  "headers": {    "property1": "string",    "property2": "string"  },  "body": "string",  "parameters": [    {      "name": "string",      "kind": "dynamic",      "location": "path",      "type": "string",      "description": "string",      "required": false,      "enum_values": [        "string"      ],      "properties": [        {          "name": "string",          "type": "string",          "description": "string",          "required": false,          "enum_values": [            "string"          ]        }      ],      "items": {        "type": "string",        "enum_values": [          "string"        ],        "properties": [          {            "name": "string",            "type": "string",            "description": "string",            "required": false,            "enum_values": [              "string"            ]          }        ]      }    }  ],  "response_map": {    "property1": "string",    "property2": "string"  },  "internal_slots": [    "string"  ],  "ack_response": {}}