Submitted in an initialized session. Returns a task_id first; read the result with get_task. Reuse the same idempotency_key only to retry.
Sample arguments generated from the tool’s live schema, required fields only. Replace the values with your own.
curl 'https://mouter.ai/mcp/tiktok_seller_products_list' \
-H "Authorization: Bearer $MOUTER_API_KEY" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H "Mcp-Session-Id: $MCP_SESSION_ID" \
-H "MCP-Protocol-Version: $MCP_PROTOCOL_VERSION" \
-d '{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "tiktok_seller_products_list",
"arguments": {
"seller_id": "123456789012",
"idempotency_key": "<IDEMPOTENCY_KEY>"
}
}
}'
These examples connect to the published MCP endpoint, submit one task and poll get_task until it completes. Set MOUTER_API_KEY in your environment before running.
Sample arguments generated from the tool’s live schema, required fields only. Replace the values with your own.
import { randomUUID } from 'node:crypto';
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
if (!process.env.MOUTER_API_KEY) throw new Error('Set MOUTER_API_KEY');
const client = new Client({ name: 'tiktok-seller-products-list', version: '1.0.0' });
const transport = new StreamableHTTPClientTransport(
new URL('https://mouter.ai/mcp/tiktok_seller_products_list'),
{ requestInit: { headers: {
Authorization: 'Bearer ' + process.env.MOUTER_API_KEY,
} } },
);
function unpack(reply) {
if (reply.isError) throw new Error(JSON.stringify(reply.content));
const value = reply.structuredContent ?? JSON.parse(
reply.content.find(item => item.type === 'text')?.text ?? 'null',
);
if (!value?.task_id || !value?.status) throw new Error('Invalid task response');
return value;
}
try {
await client.connect(transport);
const arguments_ = {
"seller_id": "123456789012",
idempotency_key: randomUUID(),
};
let task = unpack(await client.callTool({
name: 'tiktok_seller_products_list', arguments: arguments_,
}));
console.error('Task:', task.task_id);
const deadline = Date.now() + 300_000;
while (['submitted', 'queued', 'in_progress'].includes(task.status)) {
if (Date.now() >= deadline) {
throw new Error('Still running; resume get_task for ' + task.task_id);
}
await new Promise(resolve => setTimeout(resolve, 3_000));
task = unpack(await client.callTool({
name: 'get_task', arguments: { task_id: task.task_id },
}));
}
if (task.status !== 'succeeded') {
throw new Error(JSON.stringify({ task_id: task.task_id, status: task.status, error: task.error }));
}
console.log(JSON.stringify(task.result, null, 2));
} finally {
await client.close();
}
These examples connect to the published MCP endpoint, submit one task and poll get_task until it completes. Set MOUTER_API_KEY in your environment before running.
Sample arguments generated from the tool’s live schema, required fields only. Replace the values with your own.
import asyncio
import json
import os
import time
import uuid
from mcp import ClientSession
from mcp.client.streamable_http import streamablehttp_client
def unpack(reply):
if reply.isError:
raise RuntimeError(str(reply.content))
value = reply.structuredContent
if value is None:
text = next((item.text for item in reply.content if item.type == "text"), "null")
value = json.loads(text)
if not value or not value.get("task_id") or not value.get("status"):
raise RuntimeError("Invalid task response")
return value
async def main():
headers = {"Authorization": "Bearer " + os.environ["MOUTER_API_KEY"]}
async with streamablehttp_client(
"https://mouter.ai/mcp/tiktok_seller_products_list", headers=headers,
) as (read, write, _):
async with ClientSession(read, write) as session:
await session.initialize()
arguments = {
"seller_id": "123456789012",
"idempotency_key": str(uuid.uuid4()),
}
task = unpack(await session.call_tool("tiktok_seller_products_list", arguments))
print("Task:", task["task_id"])
deadline = time.monotonic() + 300
while task["status"] in ("submitted", "queued", "in_progress"):
if time.monotonic() >= deadline:
raise TimeoutError("Resume get_task for " + task["task_id"])
await asyncio.sleep(3)
task = unpack(await session.call_tool("get_task", {"task_id": task["task_id"]}))
if task["status"] != "succeeded":
raise RuntimeError(json.dumps(task, ensure_ascii=False))
print(json.dumps(task["result"], indent=2, ensure_ascii=False))
asyncio.run(main())