Tools API
The Tools API is a single inventory of the HTTP tools (api) and code tools (code) configured on your AI Agent. Use it to list, fetch, create, update, and delete tools through one Platform API instead of a separate API per type.
Endpoints
- List tools (
GET /v2/tools/): Returns the Agent’s tools in cursor-paginated pages. See List tools. - Get a tool (
GET /v2/tools/{tool_id}): Returns a single tool by itsid, including the type-specific body. See Get a tool. - Create a tool (
POST /v2/tools/): Creates anapiorcodetool. See Create a tool. - Update a tool (
PATCH /v2/tools/{tool_id}): Partially updates a tool. Write rights depend on type. See Update a tool. - Delete a tool (
DELETE /v2/tools/{tool_id}): Soft-deletes anapiorcodetool. See Delete a tool.
Read and write responses use the shared Tool envelope: id, type, name, description, inputs, outputs, enabled, direct_use, and availability. Required fields that have no value are returned as null rather than omitted.
Tool types
Code tools require the code tools product entitlement. Without it, they are omitted from the list, and GET /v2/tools/{tool_id} returns 404 for a code tool id. POST of a code tool also fails without the entitlement.
Shared fields
List tools
GET /v2/tools/ returns { data, meta: { next_page_url } }.
List items use the same Tool envelope as GET-by-id without the type body. There is no api or code key on a list item. HTTP details and source code belong on a single-tool fetch.
Results are returned in fixed source order: api, then code. Each source is ordered by id.
Query parameters
Pagination
The list is cursor-paginated. Read meta.next_page_url from the response and replay it unchanged to fetch the next page. next_page_url is null on the last or empty page. See Pagination.
A cursor is bound to the Agent that minted it and to the type and enabled filters in effect. Changing those filters mid-walk, or presenting another Agent’s cursor, returns 400.
Get a tool
GET /v2/tools/{tool_id} returns one tool in the unified Tool shape. Shared fields sit at the top level; everything specific to how the tool runs is nested under the key matching type (api or code).
Authorizationheaders are stripped fromapi.request.headers. Other header values pass through, with variable references in{var:<name>|<default>}form.- An unknown id, an id from another Agent, or a malformed id returns
404or400.
Create a tool
POST /v2/tools/ creates an api or code tool and returns the created Tool (201).
type,name, anddescriptionare required.type=apirequires anapibody withurl.type=coderequires acodebody withsource_code.- A name that collides with a tool of the other type (
api↔code) returns409. Reusing anapiname among otherapitools is not rejected. availabilityis the structured Knowledge rule object, not an internal DSL string. See Availability rules.Authorizationheaders onapitools are stored but stripped on every read.code.environmentis optional.sourceis one ofliteral,variable,secret, orsensitive_value.- If
sourceissensitive_value, GET returns an emptyvalue. A GET-then-POST copy does not copy the stored secret. Send the value again.
Update a tool
PATCH /v2/tools/{tool_id} is a merge-patch. Omitted fields are preserved. Nested objects (api, code, api.request) merge key-by-key. Arrays (inputs, outputs, headers, environment) replace when the key is present. Send the complete list, including entries that are not changing.
availability is the one null-delete: omit it to leave the rule untouched, send an object to replace, send null to detach.
Sending a different type, or a type body that does not match the tool (api on a code tool), returns 422. An empty {} body is a no-op 200.
Write rights by type
Inputs and outputs
name is the identity of each input and output. Other entities hold that name.
- Same
namewith a newdescription,type,key,source,is_visible_to_llm, orvariable.idupdates that row. - Adding a name while keeping existing names is allowed. Removing a name (send only what remains) is allowed.
- Dropping a stored name and adding a different name in the same PATCH is treated as a rename and returns
422. - Matching by
namepreservesapioutput ids, so redactions and other references stay attached whenkeychanges.
Inputs on this API are name, type, and description. The bound variable for an output is variable.id, not variable_id. required on an input is ignored on write. GET always returns it. api and code tools return null.
If headers is omitted from an api PATCH, stored headers, including Authorization, are left in place. Authorization stays stripped on read-back.
If code.environment is present, the array replaces in full. For a sensitive_value row, an empty value leaves the stored secret unchanged. Remove the row to clear it.
A name that collides with another api or code tool returns 409.
Delete a tool
DELETE /v2/tools/{tool_id} soft-deletes an api or code tool and returns 204.
- An
apitool that other entities still reference returns409. Code tools have no dependency check.
Authentication
Requests are authenticated with a Bearer API key. See Authentication for details on generating and using API keys.
API keys use the same Platform API permission as other v2 APIs. There are no per-type scopes. One key lists every tool type the Agent is entitled to.