execute_write
Execute JavaScript to perform authorized InSales API writes, using a fresh execution ID so identical retries return the journal without replaying changes.
Instructions
Execute JavaScript including writes. Provide a fresh UUID execution_id; identical retries return the journal without replay. Use get_operation to inspect completed or uncertain writes. Code is an async function body: await calls and return JSON. First return await insales.list_stores({}) to obtain store_id. Discover with catalog.search({query?:string,domain?:string,limit?:number}); inspect arguments with catalog.describe({names:string[]}), e.g. return await catalog.describe({names:["get_widget","update_widget"]}); then call insales.(args). Search without query lists domains. Batch related descriptions and compose known calls in one script; return focused data. Do not guess arguments: use inputSchema or the schema returned by validation errors. Results contain status, result/error, steps and execution_id. Large results/errors have result_ref/error_ref: read runtime.get_result(ref,{offset,limit}); inspect writes using runtime.get_execution(id). No imports, process, filesystem, crypto, timers or arbitrary network.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"execution_id": "<execution_id>",
"code": "<code>"
},
"name": "execute_write"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | JavaScript async function body. Discover with catalog.search/describe, call insales methods, return JSON. | |
| execution_id | Yes |