Skip to main content
POST
Create tool
Every endpoint on this page requires either a Clerk-issued JWT (Authorization: Bearer <token>) or an organization API key (x-api-key: pk_…). Anonymous calls return 401 Unauthorized. See Authentication for the full setup.

Code examples

Creating a POST API tool with a request body

curl

Sample response

After creating a tool, attach it to an agent by including { "toolId": "<id>" } in the tools array when creating or updating an agent.

Authorizations

x-api-key
string
header
required

Organization API key. Obtain from the dashboard. Format: pk_live_…

Body

application/json
name
string
required

Unique tool name. Alphanumeric with underscores, no leading/trailing underscore.

Pattern: ^[a-zA-Z0-9][a-zA-Z0-9_]*[a-zA-Z0-9]$
Example:

"GET_ACCOUNT_BALANCE"

description
string
required

Explains to the LLM what this tool does and when to call it.

Example:

"Retrieves the current account balance for the authenticated customer."

type
enum<string>
required

API_TOOL = HTTP webhook call. FUNCTION_TOOL = server-side function.

Available options:
API_TOOL,
FUNCTION_TOOL
ajvPropertiesSchema
object
required

JSON Schema for the tool's input parameters. The LLM uses this to construct the call.

Example:
apiTool
object

Required when type is API_TOOL.

functionTool
object

Required when type is FUNCTION_TOOL.

preExecutionMessage
string

Message sent to the user before the tool executes (e.g. 'Let me look that up...').

metaData
object

Response

Tool created.

id
string<uuid>
name
string
Example:

"GET_ACCOUNT_BALANCE"

description
string
type
enum<string>
Available options:
API_TOOL,
FUNCTION_TOOL
ajvPropertiesSchema
object
orgId
string
createdAt
string<date-time>
updatedAt
string<date-time>