Test a custom tool
import { createClient, createResources } from "@morevoice/sdk";
const mv = createResources({ client: createClient({ baseUrl: "https://api.morevoice.ai/v1", auth: process.env.MOREVOICE_API_KEY }),});
const toolTest = await mv.tools.test({ arguments: { date: "2026-11-04", }, tool: { headers: { Authorization: "Bearer crm-secret", }, name: "find_slots", timeout_seconds: 10, url: "https://crm.example.com/voice/tools", },});console.log(toolTest);import osimport uuid
import requests
response = requests.post( "https://api.morevoice.ai/v1/tools/test", headers={"Authorization": f"Bearer {os.environ['MOREVOICE_API_KEY']}", "Idempotency-Key": str(uuid.uuid4())}, json={ "arguments": { "date": "2026-11-04", }, "tool": { "headers": { "Authorization": "Bearer crm-secret", }, "name": "find_slots", "timeout_seconds": 10, "url": "https://crm.example.com/voice/tools", }, },)response.raise_for_status()print(response.json())curl -X POST https://api.morevoice.ai/v1/tools/test \ -H "Authorization: Bearer $MOREVOICE_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $(uuidgen)" \ -d '{ "arguments": { "date": "2026-11-04" }, "tool": { "headers": { "Authorization": "Bearer crm-secret" }, "name": "find_slots", "timeout_seconds": 10, "url": "https://crm.example.com/voice/tools" }}'Runs a custom tool once with the arguments you give, the way a call runs it: the same request body, signed with your tool signing secret (Standard Webhooks headers; test-mode keys sign with the test secret) and sent through the same network guard. Webhook failures (an HTTP error, a timeout) are reported in the result; a URL that cannot be called at all is a 400.
Try it in the API playground with a test-mode key.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”The API version to use for this request. Defaults to the version the API key is pinned to.
Example
2026-11-01A unique key (for example a UUID) that makes this request safe to retry: for 24 hours, a retry with the same key and parameters returns the first response instead of acting twice.
Example
5f0c1e8a-7b2d-4c3e-9f1a-2b6d8e4c0a17Request Body
Section titled “Request Body”object
The arguments, as the model would pass them (default {}).
object
The assistant whose stored tool (with its stored headers) to test.
A custom tool as you send it. headers are write-only: stored with the assistant, never returned.
object
Default legacy.
What the tool does and when to call it.
Default true.
Extra request headers, e.g. Authorization. Write-only. On update, leave it out to keep the stored headers; send {} to remove them.
object
The answer of a mock tool.
The function name the model calls (unique per assistant).
JSON Schema (an object schema) of the arguments.
object
Spoken while the tool runs.
How long to wait for the webhook, 1–60 (default 15).
Default: webhook when url is set, else mock.
The webhook URL (http or https). Required for webhook tools.
The stored tool’s name (with assistant_id).
Example
{ "arguments": { "date": "2026-11-04" }, "tool": { "headers": { "Authorization": "Bearer crm-secret" }, "name": "find_slots", "timeout_seconds": 10, "url": "https://crm.example.com/voice/tools" }}Responses
Section titled “Responses”OK
The outcome of one tool run. The request is exactly a call’s: the same body, signed with your tool signing secret (Standard Webhooks headers), through the same network guard; the call is {"id": "test"}.
object
How long the tool took.
true in live mode, false in test mode.
True when the tool answered (a 2xx for webhooks).
What the model would receive: the parsed JSON (or text) of the answer.
The tool’s name.
webhook tools were called over HTTP (signed); mock tools answered their mock_response.
Example
{ "duration_ms": 182, "error": null, "livemode": true, "object": "tool_test", "ok": true, "result": { "slots": [ "10:30", "11:00" ] }, "tool": "find_slots", "type": "webhook"}The request is invalid: a parameter is missing, malformed or unknown, or the version header is unknown.
Every /v1 error.
object
object
A stable, machine-readable code from the error-code catalogue.
Structured context, e.g. required_scope or the compliance verdict.
object
A link to the documentation of this code.
A human-readable explanation. Do not parse it.
The request parameter the error relates to, e.g. to or metadata[order_id].
The X-Request-Id of this request. Quote it when you contact support.
The category of the error.
Example
{ "error": { "code": "parameter_missing", "doc_url": "https://docs.morevoice.ai/api/errors#parameter-missing", "message": "Missing required parameter: to.", "param": "to", "request_id": "req_7Hk2LmN9pQ4rS6tV8wX0yZ", "type": "invalid_request_error" }}Headers
Section titled “Headers”The request’s ID (req_…). Quote it when you contact support.
No valid API key was sent.
Every /v1 error.
object
object
A stable, machine-readable code from the error-code catalogue.
Structured context, e.g. required_scope or the compliance verdict.
object
A link to the documentation of this code.
A human-readable explanation. Do not parse it.
The request parameter the error relates to, e.g. to or metadata[order_id].
The X-Request-Id of this request. Quote it when you contact support.
The category of the error.
Example
{ "error": { "code": "invalid_api_key", "doc_url": "https://docs.morevoice.ai/api/errors#invalid-api-key", "message": "Invalid API key.", "request_id": "req_7Hk2LmN9pQ4rS6tV8wX0yZ", "type": "authentication_error" }}Headers
Section titled “Headers”The request’s ID (req_…). Quote it when you contact support.
The key may not do this (a missing scope, a plan limit, or a compliance block).
Every /v1 error.
object
object
A stable, machine-readable code from the error-code catalogue.
Structured context, e.g. required_scope or the compliance verdict.
object
A link to the documentation of this code.
A human-readable explanation. Do not parse it.
The request parameter the error relates to, e.g. to or metadata[order_id].
The X-Request-Id of this request. Quote it when you contact support.
The category of the error.
Example
{ "error": { "code": "missing_scope", "doc_url": "https://docs.morevoice.ai/api/errors#missing-scope", "message": "This API key lacks the calls:write scope.", "request_id": "req_7Hk2LmN9pQ4rS6tV8wX0yZ", "type": "permission_error" }}Headers
Section titled “Headers”The request’s ID (req_…). Quote it when you contact support.
The request conflicts with the object’s state, or the Idempotency-Key was reused with other parameters.
Every /v1 error.
object
object
A stable, machine-readable code from the error-code catalogue.
Structured context, e.g. required_scope or the compliance verdict.
object
A link to the documentation of this code.
A human-readable explanation. Do not parse it.
The request parameter the error relates to, e.g. to or metadata[order_id].
The X-Request-Id of this request. Quote it when you contact support.
The category of the error.
Example
{ "error": { "code": "idempotency_mismatch", "doc_url": "https://docs.morevoice.ai/api/errors#idempotency-mismatch", "message": "This Idempotency-Key was already used with different parameters.", "request_id": "req_7Hk2LmN9pQ4rS6tV8wX0yZ", "type": "idempotency_error" }}Headers
Section titled “Headers”The request’s ID (req_…). Quote it when you contact support.
Too many requests, or no call capacity right now. Retry after the Retry-After delay.
Every /v1 error.
object
object
A stable, machine-readable code from the error-code catalogue.
Structured context, e.g. required_scope or the compliance verdict.
object
A link to the documentation of this code.
A human-readable explanation. Do not parse it.
The request parameter the error relates to, e.g. to or metadata[order_id].
The X-Request-Id of this request. Quote it when you contact support.
The category of the error.
Example
{ "error": { "code": "rate_limited", "doc_url": "https://docs.morevoice.ai/api/errors#rate-limited", "message": "Too many requests. Retry after 1 second.", "request_id": "req_7Hk2LmN9pQ4rS6tV8wX0yZ", "type": "rate_limit_error" }}Headers
Section titled “Headers”Seconds to wait before retrying.
The request’s ID (req_…). Quote it when you contact support.
Something went wrong on MoreVoice’s side. Retry with the same Idempotency-Key.
Every /v1 error.
object
object
A stable, machine-readable code from the error-code catalogue.
Structured context, e.g. required_scope or the compliance verdict.
object
A link to the documentation of this code.
A human-readable explanation. Do not parse it.
The request parameter the error relates to, e.g. to or metadata[order_id].
The X-Request-Id of this request. Quote it when you contact support.
The category of the error.
Example
{ "error": { "code": "internal_error", "doc_url": "https://docs.morevoice.ai/api/errors#internal-error", "message": "Something went wrong on MoreVoice's side.", "request_id": "req_7Hk2LmN9pQ4rS6tV8wX0yZ", "type": "api_error" }}Headers
Section titled “Headers”The request’s ID (req_…). Quote it when you contact support.