mv.cli
The CLI’s listen tunnel: events and tool calls forwarded to your machine. These methods are on mv.cli, where mv is your client (see the Node.js SDK). Each one returns the response object and throws when the API answers with an error.
submitToolResult()
Section titled “submitToolResult()”Answer a relayed tool call. Sends your local tool server’s answer (status and body, as it responded) for a tool_call frame of your listen session. Only the key that opened the session can answer, within the call’s timeout_ms.
mv.cli.submitToolResult(sessionId: CliSubmitToolResultData["path"]["session_id"], body: CliSubmitToolResultData["body"], options?: RequestOptions): Promise<CliSubmitToolResultResponse>POST /cli/listen/{session_id}/tool_results · API reference
Parameters
Section titled “Parameters”| Name | Type | Required | Description |
|---|---|---|---|
session_id |
string |
yes | The session’s ID (clis_…, from the cli.session frame). |
body.id |
string |
yes | The tool_call frame’s id. |
body.body |
string |
no | Your local server’s response body, as is (the tool’s answer). |
body.error |
string |
no | Your local server could not be reached: the tool call fails with this message. |
body.headers |
Record<string, string> |
no | Your local server’s response headers (informational). |
body.status |
integer |
no | Your local server’s HTTP status (default 200). |
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. |
Returns
Section titled “Returns”CliToolResult:
| Field | Type | Description |
|---|---|---|
object |
"cli_tool_result" |
Always cli_tool_result. |
id |
string |
clitc_… ID. |
session_id |
string |
— |
accepted |
true |
— |
Example
Section titled “Example”import MoreVoice from "@morevoice/sdk";
const mv = new MoreVoice(); // MOREVOICE_API_KEY from the environment
const cliToolResult = await mv.cli.submitToolResult("clis_5bH8jK3mN6pQ9rT2vW4xYz", { body: "{\"status\":\"shipped\"}", id: "clitc_7cJ9kL4mP2qR5sT8uV1wXy", status: 200,});console.log(cliToolResult);