# mv.tools

> The tools methods of @morevoice/sdk: Custom tools assistants can call.

Custom tools assistants can call. These methods are on `mv.tools`, where `mv` is your client (see [the Node.js SDK](https://docs.morevoice.ai/sdk/node/#connect)). Each one returns the response object and throws when the API answers with an error.

## `test()`

**Test a custom tool.** 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.

```ts
mv.tools.test(body?: ToolsTestData["body"], options?: RequestOptions): Promise<ToolsTestResponse>
```

`POST /tools/test` · [API reference](https://docs.morevoice.ai/api/operations/tools_test/)

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `body.arguments` | `object` | no | The arguments, as the model would pass them (default `{}`). |
| `body.assistant_id` | `string` | no | The assistant whose stored tool (with its stored headers) to test. |
| `body.tool` | `CustomToolParamsInput` | no | A custom tool as you send it. `headers` are write-only: stored with the assistant, never returned. |
| `body.tool_name` | `string` | no | The stored tool's name (with `assistant_id`). |
| `options.headers["MoreVoice-Version"]` | `string` | no | The API version to use for this request. Defaults to the version the API key is pinned to. |
| `options.headers["Idempotency-Key"]` | `string` | no | A 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. |
| `options` | `RequestOptions` | no | `idempotencyKey`, extra `headers` and an abort `signal`: see [retries and idempotency](https://docs.morevoice.ai/sdk/typescript/retries/). |

### Returns

`ToolTest`:

| Field | Type | Description |
| --- | --- | --- |
| `object` | `"tool_test"` | Always `tool_test`. |
| `livemode` | `boolean` | `true` in live mode, `false` in test mode. |
| `tool` | `string` | The tool's name. |
| `type` | `"webhook" \| "mock"` | `webhook` tools were called over HTTP (signed); `mock` tools answered their `mock_response`. |
| `ok` | `boolean` | true when the tool answered (a 2xx for webhooks). |
| `duration_ms` | `integer` | How long the tool took. |
| `result` | `any` | What the model would receive: the parsed JSON (or text) of the answer. |
| `error` | `object \| null` | null when `ok`. |

### Example

```ts
import MoreVoice from "@morevoice/sdk";

const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment

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);
```
