Register Custom Edge Function Tool
POST /api/v3/organizations/{organisation}/ai/custom-tools
Registers a custom edge function as a tool that AI models can invoke. Provide edgeFunctionCode (JavaScript) and the API will deploy it to the CDN, compute the edge function URL, and register the tool.
*
* Edge Function Contract:
* - Edge functions must accept POST requests with JSON payload
* - Expected request format: { 'toolName': '...', 'input': {...}, 'orgId': '...' }
* - Must return JSON response with either result or error field
*
* Idempotent Updates:
* POSTing with the same name will update the existing tool — the edge function code is redeployed to the same UUID and the tool registration is updated.
*
* Async Tools:
* Set isAsync: true for operations >5 seconds. The edge function should return { executionId: '...' } and the AI will poll for completion.
Authorizations
Parameters
Path Parameters
The organisation ID
Request Body required
object
Unique tool name (alphanumeric and underscores only)
check_inventoryHuman-readable description of what the tool does
Check product inventory levels in warehouseJavaScript source code for the edge function
JSON-encoded JSON Schema object defining the tool’s input parameters
Whether this tool runs asynchronously (>5 seconds)
Tool execution timeout
JSON-encoded JSON Schema object defining the tool’s output structure
Human-readable description of the tool’s output
Category to group related tools
How the tool response is handled: llm (passed back to model) or direct (returned to user)
Responses
201
Custom tool registered successfully
object
trueobject
Computed edge function URL (read-only)
https://preview.quantcdn.io/_quant/ai-exec/org/project/uuidThe deployed edge function code
Whether this was an update to an existing tool
Custom tool deployed successfully400
Invalid request parameters
403
Access denied
500
Failed to register custom tool